lokie538 Posted May 3, 2008 Share Posted May 3, 2008 Hi, I have a form that I need to display a date from a mysql server. How do I make it that a date is pulled out shown on the form and make that the date is changeable and then when its changed, update the original date in the database. At the moment I can pull out a date, show it on a form (in a text box) but when the value is changed in the text box there is an error when It is submitted. So how do I make a date changeable on the form and able to be put back in the mysql database? Thanks in advance, Lokie538 Link to comment https://forums.phpfreaks.com/topic/103962-solved-obtaining-a-date-from-a-database/ Share on other sites More sharing options...
phpSensei Posted May 3, 2008 Share Posted May 3, 2008 Post your original code. Link to comment https://forums.phpfreaks.com/topic/103962-solved-obtaining-a-date-from-a-database/#findComment-532248 Share on other sites More sharing options...
lokie538 Posted May 3, 2008 Author Share Posted May 3, 2008 ///////////////////// query (i know this works) $query4 = "SELECT * FROM `enrolmentreview` where ID ='" . $_POST['id'] . "'"; $result4 = mysqli_query($cxn,$query4) or die ("Couldnt execute queryrow4."); $row4 = mysqli_fetch_assoc($result4); ////////////////////// form <p>Contact Date: <input name="contactdate" type="text" id="contactdate" value="<?php echo $row4[ContactDate] ?> "> </p> ///////////////////// the next info is on the save page: $query2 = "UPDATE studhpe1 SET Date_Enrolled='" . $_POST[date1] . "' WHERE ID ='" . $_POST[id] . "'"; $result2 = mysqli_query($cxn,$query2) or die (mysqli_error ()); Link to comment https://forums.phpfreaks.com/topic/103962-solved-obtaining-a-date-from-a-database/#findComment-532298 Share on other sites More sharing options...
Barand Posted May 3, 2008 Share Posted May 3, 2008 1 ) I assume the id is stored in in a field in the form so it gets posted to save page 2 ) The date input field name is "contactdate" in the form but "date1" in the update query 3 ) You said there is an error. What is the error message? Link to comment https://forums.phpfreaks.com/topic/103962-solved-obtaining-a-date-from-a-database/#findComment-532332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.