PDA

View Full Version : does anybody know how to collect info from one form to go to next page and show it


nanny
06-17-2007, 07:54 AM
Hi I need to insert the information of one form into the database and then have on the next corresponding page some of the information e.g. the invoice details and allow them to place an order that then goes to the payments in the cart.
1. insert advert details
2. check invoice details and select option e.g. 6/12 months
3. information goes straight to payments in cart - elsewhere.

Thanks can only get it to work in a login form but I don't want that.
Clueless....

davidj
06-17-2007, 10:53 AM
ok the first form data goes into a form. you give that an ID (auto increment) then assign that ID to a $_SESSION and carry that around the application. When you want to retrieve or add data from/to the database just use that $_SESSION['ID'] in your SELECT or UPDATE statements

nanny
06-20-2007, 06:43 AM
Hi davidj
I have the id as an autoincrement
I tried this in the first form:

$_POST['classpremid'] = mysql_insert_id();

Then on the next page I tried this at the top of page:

session_start();
if ($_POST && !empty($_POST['classpremid'])) {
$_SESSION['classpremid'] = $row_premium['classpremid'];
}
I also substituted $row_premium['classpremid'] with $_POST['classpremid']
In the beginning of the next form I have:

if (isset($_SESSION['classpremid'])) {
echo 'Hello, '.$_SESSION['classpremid'].'. Please check details are correct for payment';
}
else {
echo 'Sorry you need to fill out the form first. <a href="premium.php">Get Your Premium Listing</a>';
}


But neither are working as the second form always says "Hello, Get Your Premium Listing"

Thanks heaps for your help.

davidj
06-21-2007, 11:52 AM
in this page


if (isset($_SESSION['classpremid'])) {
echo 'Hello, '.$_SESSION['classpremid'].'. Please check details are correct for payment';
}
else {
echo 'Sorry you need to fill out the form first. <a href="premium.php">Get Your Premium Listing</a>';
}


do you have a session_start(); at the begining of your script