use the action attribute of the form element...i usually make the pages submit back to themselves so that eveything is contained in one page....
the trick is to modularize (is that a word??) the forms as much as possible...take the whole registration form, which should be the same as the one used to update the users info, and put it in a function (function show_form()π on another page (ie called common.php)
then simply
<?
require("common.php");
and call the form when needed...it would take way more code to show how it all ties together, but i would check to see if the main call a registration link (a hyperlink with a reg=1 value ) and show the form
<?
require("common.php");
if ($reg==1){
show_form();
}else{
//consider to be update request
if (!submit){
//show the form with data
if ((!$newpassword)&&(!newpassconfim)){
//update all other info - leave old password alone
}elseif ($newpassword!=$newpassconfim){
//error check to see if passwords match- if they don't send error
//message and the user back to the form. note that passwords
//do not persist in the browser forms...you may want to code
//to remember all the other values (if any) to allow for best
//user interface and least aggravation.
//this script creates a pop up warning box and when clicked
//will take the user back one page. or you can handle it
//another way, it's all good.
echo "html><script language=\"javascript\">
function errors(){
alert("The new passwords do not match!");
history.go(-1);
}
</script><body onLoad"errors();"></body></html>";
}elseif ($newpassword==$newpassconfim){
//update the data changes including the password
}
?>
hth
π