WilliamNova Posted January 10, 2014 Share Posted January 10, 2014 Wasn't sure how to word the subject. Anyways, I have a form that is supposed to update multiple fields at once. Howevever, it's only updating the first one and that's gender. It will not update Location, or About or anything else. Here's the function that's in an include file. <?php if (isset($_POST['gender'])) if (isset($_POST['location'])) if (isset($_POST['about'])) if (isset($_POST['twitter'])) if (isset($_POST['facebook'])) { $gender = mysql_real_escape_string($_POST['gender']); $location = mysql_real_escape_string($_POST['location']); $about = mysql_real_escape_string($_POST['about']); $twitter = mysql_real_escape_string($_POST['twitter']); $facebook = mysql_real_escape_string($_POST['facebook']); // Update mysql_query("UPDATE users SET gender='$gender', location='$location', about='$about', twitter='$twitter', facebook='$facebook' WHERE user_id='$user_id'"); } ?> Here's the form <form action='home.php' method='POST'> <b>Gender:</b> <?php echo "$gender"; ?><br /> <input type='radio' name='gender' value='Male' />Male <input type='radio' name='gender' value='Female' />Female<br /> <br /> <b>Location:</b><br /> <textarea name='location' value='location' class='ta3'><?php echo "$location"; ?></textarea><br /> <br /> <b>About:</b> (150 chars or less)<br /> <textarea name='about' value='about'><?php echo '$about'; ?></textarea><br /> <br /> <b>My Twitter:</b><br /> @<textarea name='twitter' value='twitter' class='ta4'><?php echo "$twitter"; ?></textarea><br /> <br /> <b>My Facebook:</b><br /> facebook.com/<textarea name='facebook' value='facebook' class='ta4'><?php echo "$facebook"; ?></textarea><br /> <input type='submit' name='submit' value='Update' /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/285251-form-partially-submits/ Share on other sites More sharing options...
WilliamNova Posted January 10, 2014 Author Share Posted January 10, 2014 Also, I have used error_reporting(E_ALL|E_STRICT); And nothing... Quote Link to comment https://forums.phpfreaks.com/topic/285251-form-partially-submits/#findComment-1464672 Share on other sites More sharing options...
Solution WilliamNova Posted January 10, 2014 Author Solution Share Posted January 10, 2014 Okay, I figured it out. I changed the radio input fields to select/option fields and now it works perfect. Quote Link to comment https://forums.phpfreaks.com/topic/285251-form-partially-submits/#findComment-1464674 Share on other sites More sharing options...
cyberRobot Posted January 10, 2014 Share Posted January 10, 2014 For what it's worth, the original form (with the radio buttons) works fine for me. Well, except for the $about variable being enclosed in single quotes. <textarea name='about' value='about'><?php echo '$about'; ?></textarea><br /> You either need to use double quotes or they could be left off altogether. <textarea name='about' value='about'><?php echo $about; ?></textarea><br /> Perhaps there was a MySQL error, did you try using mysql_error()? More information and examples can be found here: http://www.php.net/mysql_error Did you try seeing what the variables contained? For example, the following would have told you if your location variables actually contained any data: $location = mysql_real_escape_string($_POST['location']); var_dump($_POST['location']); var_dump($location); Quote Link to comment https://forums.phpfreaks.com/topic/285251-form-partially-submits/#findComment-1464699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.