Undefined variable:
Posted: Fri Jul 05, 2002 12:49 am
I am having a bit of a problem with a script I am running that takes its info from a database and lets the user update their profile. Everytime the user logs in through the edit form, the edit script returns: "Notice: Undefined variable: action".
This is the first instance of action:
I am not sure how I am supposed to define the variable "action" using PHP4.2.0, since it is not passed from the form until the user updates his profile.
This is the second instance:
I know this has to do with the globals set to off, I just dont know what to do until the variable is passed from the form on the previos page, like the name and password ie:
$action is not passed until the user updates the profile?
Can anyone help me to understand this?
Thanks
This is the first instance of action:
Code: Select all
if ($action == "edit_two") {
$user = mysql_query("UPDATE personalize SET Password='$Password',Weather='$Weather' WHERE (Name='$Name')");
setcookie("site_user", $Name, time() + 31536000, "/");
setcookie("site_pass", $Password, time() + 31536000, "/");
showheader("Edit Success!");This is the second instance:
Code: Select all
<FORM METHOD=POST ACTION="<?php echo $_SERVERї'PHP_SELF'] ?>">
<INPUT TYPE="hidden" NAME="Name" VALUE="<?php echo $infoї'Name'] ?>">
<INPUT TYPE="hidden" NAME="action" VALUE="edit_two">Code: Select all
$Name = $_POSTї'Name'];
$Password = $_POSTї'Password'];Can anyone help me to understand this?
Thanks