Jump to content

re POSTing echo POST without INPUT


bcraig

Recommended Posts

Ive got a form for creating a record and it posts to a confirmation page. I want the confirmation page to echo all the POST data into another form which on submit will POST to a mysql INSERT query.

 

Is this possible without having input fields on the confirmation page? or are there ways to set the input boxes to be invisable and only show the data and be non-editable??

 

PHP version:5.2.5

Link to comment
https://forums.phpfreaks.com/topic/82633-re-posting-echo-post-without-input/
Share on other sites

well bro there are two methods to do this ...in the previewing page you can use the hidden fileds in the form just like

<input type='hidden' name='email' value="<?=$_POST['email']?>" />

or You can assin these values to the session variable in the preview page and insert the values of the session in the third page.

 

http://php-ajax-guru.blogspot.com

http://roshanbh.com.np

You could do this:

<?php

$_SESSION['posted'] = $_POST;

 

//print out post data here as regular HTML, not a form.

//Name: John Doe

//Email: [email protected]

?>

 

Then on the next page, instead of processing the $_POST array, process the $_SESSION['posted'] array.

Its a better way that when you first post the data "Save Data in Session". Later on second post Collect data from session and save in Database.

 

Example :

(1) Save Data in sesison
$_SESSION['data'] = array();
if(isset($_POST)){
   foreach($_POST as $key => $value)
           $_SESSION['data'][$key] = $value;
}
(2) On Next page you will found all data in Array
echo "<pre>";
print_r($_SESSION['data']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.