bradkenyon Posted October 10, 2008 Share Posted October 10, 2008 I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing print $id; //testing $email=addslashes($HTTP_POST_VARS['email']); $lname=addslashes($HTTP_POST_VARS['lname']); $fname=addslashes($HTTP_POST_VARS['fname']); print $lname; //which table do we update switch($table) { case "maillist": $result = mysql_query("UPDATE $table SET email='$email', lname='$lname', fname='$fname' WHERE id='$id'") or die(mysql_error()); break; } } The function updateForm($table, $id); just outputs the form, has email, lname, fname fields. And when you process the form, the action is the same, w/ the table and id being passed thru the url, so it GET's the id and table that way, and for lname, fname, and email, it should grab it via post. But for some reason, it does not post the values. Link to comment https://forums.phpfreaks.com/topic/127810-solved-why-won%E2%80%99t-it-post-these-values/ Share on other sites More sharing options...
redarrow Posted October 10, 2008 Share Posted October 10, 2008 use a form value example <?php if($_POST['submit']){ $email=mysql_real_escape_string($_POST['email']); $lname=mysql_real_esacpe_string($_POST['lname']); $fname=mysql_real_escape_string($_POST['fname']); switch($table) { case "maillist": $result = mysql_query("UPDATE $table SET email='$email', lname='$lname', fname='$fname' WHERE id='$id'") or die(mysql_error()); break; } } ?> Link to comment https://forums.phpfreaks.com/topic/127810-solved-why-won%E2%80%99t-it-post-these-values/#findComment-661668 Share on other sites More sharing options...
bradkenyon Posted October 10, 2008 Author Share Posted October 10, 2008 perfect, thank you! Link to comment https://forums.phpfreaks.com/topic/127810-solved-why-won%E2%80%99t-it-post-these-values/#findComment-661670 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.