|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Form Problems
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? |
|
#2
|
||||||||
|
||||||||
|
RE: Form Problems
Q1: To clear the fields :
php Code:
I am unsure how compatible this is with netscape, but it should work fine in IE. Q2: You could do something like : php Code:
Q3: Use ob_start() at the top of your script to enable output buffering.. either that or edit your php.ini and set the output_buffering to on --- Hope that helps |
|
#3
|
|||||
|
|||||
|
RE: RE: Form Problems
this should work with netscape/mozilla as well... php Code:
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Form Problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|