Jump to content

ianhaney10

Members
  • Posts

    21
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ianhaney10's Achievements

Member

Member (2/5)

0

Reputation

  1. I need some help with getting checkbox values sent to email using phpmailer I have not done it before so unsure how to do it, the current code I have is below $postData = $_POST; $oneway = $_POST['oneway']; $return = $_POST['return']; $htmlContent = '<h2>Contact Form Details</h2> <p><b>One Way:</b> ' . $oneway . '</p> <p><b>Return:</b> ' . $return . '</p> <form action="#errors" method="post" class="formontop"> <div class="booking-form"> <div class="row mb-4"> <div class="col-lg-6"> <div class="form-check"> <input type="checkbox" name="oneway" class="form-check-input" value="<?php echo !empty($postData['oneway'])?$postData['oneway']:''; ?>"> <label class="form-check-label" for="oneway"> One Way </label> </div> </div> <div class="col-lg-6"> <div class="form-check"> <input type="checkbox" name="return" class="form-check-input" value="<?php echo !empty($postData['return'])?$postData['return']:''; ?>"> <label class="form-check-label" for="return"> Return </label> </div> </div> <button class="default-btn" type="submit" name="submit">Get My Quote</button> </div> </div> </form>
  2. Think I just solved it by changing a line to the following if(!isset($_SESSION["account_loggedin"]) || $_SESSION["account_loggedin"] !== true || $_SESSION["account_role"] != 'Member' && $_SESSION["account_role"] != 'Secretary') {
  3. I have two different user roles, one is Member and the other is Secretary and I need to be able to allow access to a php page if either Member or Secretary is logged in. I originally had the code below which worked if a Member role was logged in <?php session_start(); // If the user is not logged in redirect to the login page... if(!isset($_SESSION["account_loggedin"]) || $_SESSION["account_loggedin"] !== true || $_SESSION["account_role"] != 'Member') { include('includes/baseurl.php'); $title = "Show Diary - The British Rabbit Council"; $pgDesc=""; include ( 'includes/header.php' ); ?> I added the Secretary role to the code but it won't allow me to access the page, I think it's because I'm not logged in as a Member role and am logging as the Secretary role but I need access to the php page if I am logged in as either Member or Secretary The current code I have is below <?php session_start(); // If the user is not logged in redirect to the login page... if(!isset($_SESSION["account_loggedin"]) || $_SESSION["account_loggedin"] !== true || $_SESSION["account_role"] != 'Member' || $_SESSION["account_role"] != 'Secretary') { include('includes/baseurl.php'); $title = "Show Diary - The British Rabbit Council"; $pgDesc=""; include ( 'includes/header.php' ); ?> Can anyone help please, thank you in advance
  4. I have some php code that says if index.php or main root then display some code and if not then show other code and it works on index.php but if it's just the domain name without index.php at the end, it don't work. I have the following code at the moment <?php $currentpage = $_SERVER['REQUEST_URI']; if($currentpage=='/' || $currentpage=="/index.php" || $currentpage=="index.php" || $currentpage=="" ) { ?> Can anyone help me out please as I don't know what to amend for the code to work if main root and not have index.php at the end, the code should be the same for the main root / and index.php
  5. Thank you for the code and the other points, I'm not 100% on PDO and would need to re do the whole system in PDO as it's all done in mysqli but for now I'm not sure what the code would be in mysqli to do the dynamically built where clause
  6. I have just found this code which is look bit more easier to follow but again bit unsure where it would fit in to the current code <?php $where ="1=1"; if(isset($_POST['Station']) && !empty($_POST['Station']) && $_POST['Station'] !='All') { $where .=" and station = '$Station'"; } if(isset($_POST['Section']) && !empty($_POST['Section']) && $_POST['Section'] !='All') { $where .=" and section= '$section'"; } "SELECT StationName, SectionName FROM profiles WHERE".$where
  7. That's where I would get bit stuck, I tried to google it and found code that would work but I'm unsure where in my current code it would go The lorry name is repeated in the sales data on the sales page Instead of this code echo "<option value=\"{$row['lorry']}\" $selected>{$row['lorry']}</option>"; Should I have echo "<option value=\"{$row['id']}\" $selected>{$row['lorry']}</option>"; The code I found online for the all data is below but was unsure to fit that into the current code, obviously it needed amending to be lorryall instead of username or something like that and lorry instead of username but though if can get the code right first then can change the names $username_part = ""; if ($username != 'ALL') { $username_part = "username = '$username' AND"; } $q = "SELECT * FROM reports WHERE $username_part section_name = '$section_name' AND qeblah_status = '$qeblah_status' AND prayer_painting = '$prayer_painting' AND fatwa_status = '$fatwa_status'";
  8. Ahh ok, I don't have a value that matches the lorry name called all or All Lorries but be good to show all the lorries within the dates but sounds like it's using all three fields to search for the data, would I possibly then need two sql queries so if select All Lorries then would show all the lorries no matter the dates chosen or if the dates could be left empty and if I choose Basildon Lorry or Wickford Lorry and choose a start and end date then would show the lorry data as it does currently
  9. I've attached the whole code in a txt file as thought might be easier to see all the code CURRENT CODE FOR FORUM.txt
  10. Sorry found the problem , I spotted > was missing at the end of option where it's got </option\n"; I added the > and it's displaying the Wickford Lorry option now and it's working just apart from the All Lorries, it's displaying no data but thought it would show the data for the dates chosen, I can paste the whole code if needed in a txt file
  11. I have changed the db password I have also tried the code and it's staying on the selected dropdown value but it's stopped bit of it from working, for example if I select All Lorries, no data is displayed but the dates are correct so thought it would do Also the other bit that is happening is it's not showing the third dropdown value which should say Wickford Lorry, it stops after the Basildon Lorry The basic html code without the PHP is outputted as the following <select name="lorry" id="lorry" class="custom-select select-2"> <option value="all">All Lorries</option> <option>Basildon Lorry</option>Wickford Lorry Date Start </select> The code I have is below <select name="lorry" id="lorry" class="custom-select select-2"> <option value="all">All Lorries</option> <?php $mysqli = new mysqli('localhost', '', '', ''); $sql = "SELECT id, lorry FROM lorries"; $result = $mysqli->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $sel = ($row['lorry'] == $_GET['lorry']) ? 'selected' : ''; echo "<option $sel >{$row['lorry']}</option\n"; } } ?> </select>
  12. Dam it, I forgot to remove the db info I normally remove the db crendentials before posting but bit stressed today, I'll change the db password I'll try that code though and post a update, thank you for the code. I'll post a update once tried in a few mins
  13. I have been making a select dropdown that populates with values from a database table and got that working and on the page, it's a sales report page so I select the dropdown option value I want then put the dates in and click filter and it shows the results in a table below the form fields and it's working but when the page refreshes after clicking filter, the select dropdown resets and go back to the very first option in the select dropdown, I have tried to add selected to the option value but I am not doing it right as the vales don't have selected in the inspect element code but that may be because the page is refreshing The current select dropdown code is below as thought that may be only part that's relevant to my post but can paste the whole code as a txt file if needed <select name="lorry" id="lorry" class="custom-select select-2"> <!--<option value="all">All Lorries</option>--> <?php $mysqli = new mysqli('localhost', 'wwwbeechwoodsolu_collrystmusr', '********', 'wwwbeechwoodsolu_coal-lorry-system'); $sql = "SELECT id, lorry FROM lorries"; $result = $mysqli->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { ?> <option value="<?php echo $row["lorry"]; ?>" <?php echo ($id == $row['id'])? 'selected="selected"':'' ?>><?php echo $row['id'] . ' ' . $row["lorry"]; ?></option> <?php } } ?> </select>
  14. Ahh ok, below is the same text with the html tags <h2 class="productsummaryheading mb-0">Product Summary</h2> <br> &nbsp; <br> This 11.6” Chromebook is light, portable, rugged, and productive – the ultimate everyday learning tool. It brings Google Classroom, G Suite for Education, and today’s ...<a href="/shop/laptops-tablets/Laptops/lenovo-100e-chromebook-g2-laptop-11-6-celeron-n4020-4gb-32gb-emmc-webcam-wi-fi-no-lan-usb-c-chrome-os#productdescription">Read More</a> The <h3 tags are already removed, just leaves the other tags I want to remove such as the two <br> tags and the whitespace/&nbsp; code. Hopefully that helps and explains it bit better
  15. Thank you so much for the reply, I did try functions and they don't seem to work properly in the .tpl file. I tried your code above but still got the br tags showing still unfortunately in the text at the beginning
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.