|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have created a page to fill in the details like name, upload a wav file, enter the text blah blah, on clicking continue it's directed to second page ( which I call as review page ) like display the datas entered in 1st page.
Now on clicking save button, the entered details should be saved in a table format as below ( page3.php ): Code:
Form name create date sent date status action form1 10/2/2009 12/2/2009 completed (heckbox ) form2 10/23/2009 11/3/2009 In-complete " Finally at end a delete and select all button. So if the user clicks over form1, It'll direct it to new form page and process would be repeated as before. How can I do the save part in a table format as above in php? |
|
#2
|
||||
|
||||
|
When you say "save part in a table format" do you mean you want to store the data in some permanent way ? or just present it to the user in this way?
__________________
There is no spoon. |
|
#3
|
|||
|
|||
|
I want to do both.
But for now I want to present it to the user in this way. |
|
#4
|
||||
|
||||
|
So you want to have a sort of repeatable loop where you a user can input some information, see the data they submitted presented to them and then allow them to fill the form again and then see both submissions... That's what I'm understanding
So I guess the way I would do it is this. page1: the form they fill out page2: a script that will parse the form details from $_POST and store them in an array in the $_SESSION as such <?php $x = count($_SESSION['CART']); $_SESSION['CART'][$x]['created_date'] = $_POST['created_date']; $_SESSION['CART'][$x]['sent_date'] = $_POST['sent_date']; $_SESSION['CART'][$x]['status'] = $_POST['status']; header('location:http://mysite.com/display'); ?> Then a third page to read the session vars and display them on screen <?php echo '<form action='update.php' method='post'><table>' $x = 0; foreach($_SESSION['CART'] as $row){ echo '<tr>'; echo '<td><input type="checkbox" id=$x /></td>'; echo '<td>'.$row['created_date'].'</td>'; echo '<td>'.$row['sent_date'].'</td>'; echo '<td>'.$row['status'].'</td>'; echo '</tr>'; } echo '</table></form>'; ?> This is pretty rough but should give you a starting position. Let me know what you need clarification on . ?> |
|
#5
|
|||
|
|||
|
Hey,
Let me stop confusing you. I'll explain clearly what I'm trying to do. To say the truth I have nearly 2 or 3 php pages connected. In page1.php as mentioned earlier I have form with name of candidate, other details. on clicking continue it'll get direct to the page2.php, where that's different thing. In page 1 I have two buttons Save and Continue. So on clciking save I want to direct it to page3 ( a page where user details eneterd would be display his/her name with create and sent date along with checkbox. The part of my page1.php code Code:
<div align="center"> Name of the Candidate:<input type="text" name="event"> <br/> <br/> Upload a file:<input type="file" name="datafile" size="40"> <br/> <br/> </p> <br /> <p> <input type="submit" value="Save" name="save"> <input type="submit" value="Continue" name="continue"> </p> Code:
<form method="post" action="page2.php" enctype="multipart/form-data"> The form whether save or continue would direct the page to page2.php. But I want to direct to page2.php on save and page3.php on continue. Any help! |
|
#6
|
|||
|
|||
|
you would probably have to use javascript to change the action of the form depending on which button, save or continue, was clicked. The other option (I just tested and appears to work) would be to just leave the form to post to page2 and check in the post vars under the button name for what which button was clicked. If the save button was clicked, save the post vars to session and do a header redirect to page3 where you pull the vars off of the session. something like:
page1.php PHP Code:
page2.php PHP Code:
page3.php PHP Code:
the idea in this is that if you have a form with two submit buttons, only the one you click on is passed in the $_POST array. so on the second page (page2.php) we check if the save button was pressed instead of the continue button and if so save the data from the form in $_SESSION and move to page3.php. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > To save the contents after completing the page/form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|