| | |
submit button
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hello,
i have a serious problem
i have 4 pages
1st page: user enters his first, middle and last name. + a submit button to the 2nd page
2nd page: he enters his Gender, Age and Marital status. + a submit button to the 3rd page
3rd page: Address, City and Country + a submit button to the 4th page
4th page: he is asked some questions, + a submit button to insert data into Database
The problem is that the data is entered to db, after loading page 4, and not when clicking the submit button. So the data entered in page 4 are not entered to db
so what could i do to resolve this problem
plz help
This is the code of page4.php:
i have a serious problem

i have 4 pages
1st page: user enters his first, middle and last name. + a submit button to the 2nd page
2nd page: he enters his Gender, Age and Marital status. + a submit button to the 3rd page
3rd page: Address, City and Country + a submit button to the 4th page
4th page: he is asked some questions, + a submit button to insert data into Database
The problem is that the data is entered to db, after loading page 4, and not when clicking the submit button. So the data entered in page 4 are not entered to db
so what could i do to resolve this problem

plz help
This is the code of page4.php:
PHP Syntax (Toggle Plain Text)
<?php session_start(); $Fname = $_SESSION['fname']; $Mname = $_SESSION['mname']; $Lname = $_SESSION['lname']; $Gender = $_SESSION['gender']; $Age = $_SESSION['age']; $Mstatus = $_SESSION['mstatus']; $Address = $_SESSION['address']; $City = $_SESSION['city']; $Country = $_SESSION['country']; ?> <html> <head><title> Registration page four </title></head> <body> <?php // insert data to db ?> <form name="page4form" method="post" action="registered.php"> <p> In order to register to our website, you should fill this information: </p> <table width ="500" border ="0" cellpadding = "2" cellspacing ="0"> <tr> <td colspan="2"> </td> </tr> <tr> <td width="200">a. Do you smoke?</td> <td> <input name="smoke" type="radio" id="smoke" value="Y">yes<br> <input name="smoke" type="radio" id="smoke" value="N">No<br> </td> </tr> <tr align="center"> <td colspan="2"><input name="submit" type="submit" value="Register"></td> </tr> </table> </form> </body> </html>
•
•
Join Date: Apr 2006
Posts: 66
Reputation:
Solved Threads: 11
maybe on yhe 3rd page after processing the data you also insert into database.
Your php insert is happening as page 4 loads. Move the insert up to the top with the rest of the php. Also, surround the insert with a conditional to check if the smoke button has been selected
and the submit button has been pushed i.e.:
and the submit button has been pushed i.e.:
php Syntax (Toggle Plain Text)
if(isset($_POST['submit']) && isset($_POST['smoke'])){ //insert into the db }
fine, that's work, thanks alot
but i do have some other problem:
in a page, i have 2 button one for delete and other for update
as for the update i link the user to another page, im ok with that
but for the delete, who would i hide the button delete and update
this is the code:
but i do have some other problem:
in a page, i have 2 button one for delete and other for update
as for the update i link the user to another page, im ok with that
but for the delete, who would i hide the button delete and update
this is the code:
PHP Syntax (Toggle Plain Text)
$action = $_POST['action']; if ($action==0) //present the form { ?> <form name="updateform" action = "update.php?ID=<?php echo $ID; ?>" method="post"> <input type="hidden" name="action" value="update"> <input name="update" type="submit" value="Update User Data"></div> </form> <form name="deleteform" method="post" action="<? echo $_SERVER['PHP_SELF']?>"> <input type="hidden" name="action" value="delete"> <input name="delete" id="delete" type="submit" value="Delete User" onClick="return checkDelete();" > <?php } if (($action=="delete") && isset($_POST['delete'])) // so the delete button is pressed { // delete user ?> <a href="registered.php"> Back to registered users</a> <?php } ?> </form>
Not exactly sure what you are asking. You want to hide the delete button? If so, use css:
php Syntax (Toggle Plain Text)
<input name="delete" id="delete" type="submit" value="Delete User" onClick="return checkDelete();" <?php if(some condition){echo "style='display:none'"; }?> />
![]() |
Similar Threads
- submit button code (Perl)
- how to set the multiple submit button in asp (ASP)
- submit button (JSP)
- VB6 submit button sends information to BBChat (Visual Basic 4 / 5 / 6)
- Submit Button Help (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: PHP Navigation help please
- Next Thread: video to flash conversion
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





