Search the Community
Showing results for tags 'php coding'.
-
I looked at several community forums, and I am unable to figure it out on how to retain select option value after validation fails. Here is the code that works for me, but values disappear when submit button is submitted. <select id="service" name="service" class="searchoption"> <option value="">-- Select Service Name --</option> <?php $resultservice = mysqli_query($con,"Select * from services") ?> <?php while ($line = mysqli_fetch_array($resultservice)) { ?> <option value="<?php echo $line['serviceid'];?>"> <?php echo $line['service'];?> </option> <?php } ?> </select> Here is what I tried and doesn't work for me: <select id="service" name="service" class="searchoption"> <option value="">-- Select Service Name --</option> <?php $resultservice = mysqli_query($con,"Select * from services") ?> <?php while ($line = mysqli_fetch_array($resultservice)) { ?> <option value="<?php echo $line['serviceid']; if ($_POST['service'] == $service) {echo 'selected="selected"'} echo $line['serviceid']; ?>"> <?php echo $line['service'];?> </option> <?php } ?> </select>
- 12 replies
-
- php coding
- web application
-
(and 1 more)
Tagged with:
-
I have basic PHP knowledge, I am looking to improve on this fundamental knowledge by building PHP applications and using OOP principles, I am looking for a PHP friend, ideally someone we could discuss php coding ideas and brainstorm issues together.
-
I have a small html form that I would like to use to gather data from. The code is <?php $Name = $_POST['Name']; $Email = $_POST['Email']; $Telephone = $_POST['Telephone']; $Message = $_POST['Message']; $to = "ywaters2@hotmail.com"; $subject = "New Message"; mail ($to, $subject, $Message, "From: ". $Name); echo "Your message has been sent"; ?> I have no idea where the error is I keep getting. Can anyone help me out, please? Thank you for your help!!
-
Hello I am trying to create a web form that inserts user data. So how it works is that a user selects a department (departmentQ) from the drop down list and is routed to a second page that displays the people in the selected department in a drop down menu. On this second page users are required to select one of the displayed people and then assign them to specific task and insert it into the database. What I would like to know if there is a way that I can code the page to automatically re-execute the deaprtmentQ query without the user having to physically go back to selecting a department page. Any assistance would be greatly appreciated