waynew Posted June 19, 2008 Share Posted June 19, 2008 Hey guys. I have a small problem that I know somebody will probably solve in a second. I have a page for those who want to edit details about whatever company they choose. All details are stored in mySQL. Now, taking these values out an placing them in text areas like this: echo "<input type=\"text\" name=\"county\" id=\"county\" value=\"".$cfg_counties[$countyNum]."\"><br/><br/>"; ... isn't the problem. The problem also isn't to do with the mySQL update, which is working fine. The problem is that if I don't change the data in a form, it is automatically changed to blank once I post the form. Any ideas about how to get around this problem? Again, probably simple. Thanks guys. Link to comment https://forums.phpfreaks.com/topic/110895-solved-small-update-problem/ Share on other sites More sharing options...
Stephen Posted June 19, 2008 Share Posted June 19, 2008 What's your script when you're updating it & submitting the form? And when you see the form, it isn't blank right? Link to comment https://forums.phpfreaks.com/topic/110895-solved-small-update-problem/#findComment-568929 Share on other sites More sharing options...
waynew Posted June 19, 2008 Author Share Posted June 19, 2008 The update script is as follows: if(isset($_POST['updating'])){ //check to see if user is updating $new_company_name = $_POST['compname']; $address_one = $_POST['address1']; $address_two = $_POST['address2']; $countyname = $_POST['county']; $num = array_search($countyname,$cfg_counties); //uses array of counties and matches county to key for purpose of insertion. mysql_query("UPDATE jobs SET company_name = '$new_company_name', address1 = '$address_one', address2 = '$address_two', county = '$num' WHERE company_name = '$company_name'"); } Link to comment https://forums.phpfreaks.com/topic/110895-solved-small-update-problem/#findComment-568931 Share on other sites More sharing options...
waynew Posted June 19, 2008 Author Share Posted June 19, 2008 Thanks for the help. Just solved it. All the best. Link to comment https://forums.phpfreaks.com/topic/110895-solved-small-update-problem/#findComment-568935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.