hi
i have a form that i'd like to update a mysql table with.
here's the code for the form
<?
require_once("medill_fns.php");
session_start();
do_html_header("Step 2: Application Data Form - Master's in Journalism Program");
display_user_menu_top();
display_submenu_pg1();
check_valid_user();
if (!($conn = db_connect()))
return false;
$result = mysql_query( "select *
from user
where email = '$valid_user'");
$row = mysql_fetch_array($result); //getting info from row in db
$userid = $row['userid'];
$firstname = $row['firstname'];
$middlename = $row['middlename'];
$lastname = $row['lastname'];
if (!$result)
return false;
//this passes expressions to another function that displays the html for the submission form
display_mjp_pg1($userid,$firstname,$middlename,$lastname);
display_submenu_pg1();
display_user_menu();
do_html_footer();
?>
the form's action is set to post to this page
<?
// include function files for this application
require_once("medill_fns.php");
session_start();
check_valid_user();
// attempt to register, here i'm attempting to pass var's from the form to a separate function called register_mjp1 on a separate page
$reg_result = register_mjp1($userid, $firstname, $middlename, $lastname, $maidenname, $appld, $appldyr, $ss1, $ss2, $ss3, $gender, $citizen, $cocitizenship, $pobcity, $pobstate, $pobcountry, $dob1, $dob2, $dob3, $ethnicity, $other);
if ($reg_result == "true")
{
// provide link to members page
do_html_header("Your information has been saved.");
echo "Your information has been successfully saved.";
echo "<br>";
do_HTML_URL("member.php", "Go to members page");
}
else
{
// otherwise provide link back, tell them to try again
do_html_header("Problem:");
echo $reg_result;
do_html_footer();
exit;
}
// end page
do_html_footer();
?>
here's the code for register_mjp1 function
function register_mjp1($userid, $firstname, $middlename, $lastname, $maidenname, $appld, $appldyr, $ss1, $ss2, $ss3, $gender, $citizen, $cocitizenship, $pobcity, $pobstate, $pobcountry, $dob1, $dob2, $dob3, $ethnicity, $other)
// save mjp_pg1 info
// return true or error message
{
// connect to db
$conn = db_connect();
if (!$conn)
return "Could not connect to database server - please try later.";
// if ok, put in db
$result = mysql_query("update user
set middlename='$middlename'
where userid='$userid'");
if (!$result)
return "Could not save your information in the database - please try again later.";
return true;
}
here, i'm only trying to update one variable, middlename.
the submission form submits successfully and i get the message that info has been successfully saved into the db, but when i check the value of middlename in the db, it's unchanged. i get no errors.
i'd like this form to update the db. if anyone can tell me where i'm messing up i'd really appreciate it...
thanks
d.a.