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. Quote Link to comment 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; } } ?> Quote Link to comment Share on other sites More sharing options...
bradkenyon Posted October 10, 2008 Author Share Posted October 10, 2008 perfect, thank you! Quote Link to comment 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.