Hi there,
I have a form for updating the user profile:
<form method="post" action="UserCP.php">
<input name="FirstName" value="<? echo "$FirstName"; ?>">
<input name="Password">
<input type="submit">
<input type="reset">
</form>
Q1. The first problem is when I view one of the input fields with a value like FirstName, the value will be inserted inside the input field, so when I try to hit the reset button, it's not working! Well, if it has to be this way, can I change the action of the reset button so it acts like a link to another page?
Q2. Look to the following code:
$Query = "UPDATE Users
SET FirstName = '$FirstName'
WHERE UserID = '$UserID' ";
I want to insert a condition inside the Query so if the user fill the Password input field, then the $Password will be inserted in the Query. Otherwise, I dont want to update the password field with an empty value, How can I do it? or the solution is I have to make 2 seperate queries for both conditions? If this is the way, then its really a pain in the neck if I have 10 conditions!!
Q3. If a code is simmilar to the follwoing:
echo "UserName: $HTTP_COOKIE_VARS[CkUserName]";
echo "Password: $HTTP_COOKIE_VARS[CkPassword]";
$Query = "UPDATE Users SET Password = '$NewPassword'
WHERE UserID = '$UserID' ";
setcookie ("CkPassword", $NewPassord, time()+14400, "/", ".mydomain",0);
And when I run the code, its not accepted cause there is an output before the setcookie! Ok, anyway to make my setcookie works without changing the echo location to be down the setcookie, cause my code is too much complicated to change the place of the echo, if its imposible to avoid this, any other idea how can I change the cookie contents when the user change his password?
I have a form for updating the user profile:
<form method="post" action="UserCP.php">
<input name="FirstName" value="<? echo "$FirstName"; ?>">
<input name="Password">
<input type="submit">
<input type="reset">
</form>
Q1. The first problem is when I view one of the input fields with a value like FirstName, the value will be inserted inside the input field, so when I try to hit the reset button, it's not working! Well, if it has to be this way, can I change the action of the reset button so it acts like a link to another page?
Q2. Look to the following code:
$Query = "UPDATE Users
SET FirstName = '$FirstName'
WHERE UserID = '$UserID' ";
I want to insert a condition inside the Query so if the user fill the Password input field, then the $Password will be inserted in the Query. Otherwise, I dont want to update the password field with an empty value, How can I do it? or the solution is I have to make 2 seperate queries for both conditions? If this is the way, then its really a pain in the neck if I have 10 conditions!!
Q3. If a code is simmilar to the follwoing:
echo "UserName: $HTTP_COOKIE_VARS[CkUserName]";
echo "Password: $HTTP_COOKIE_VARS[CkPassword]";
$Query = "UPDATE Users SET Password = '$NewPassword'
WHERE UserID = '$UserID' ";
setcookie ("CkPassword", $NewPassord, time()+14400, "/", ".mydomain",0);
And when I run the code, its not accepted cause there is an output before the setcookie! Ok, anyway to make my setcookie works without changing the echo location to be down the setcookie, cause my code is too much complicated to change the place of the echo, if its imposible to avoid this, any other idea how can I change the cookie contents when the user change his password?