Jump to content

Variables through forms


Snooble

Recommended Posts

i send it to a php page via POST looking like this:

 

<?php 
include 'sessionstartandsql.php';
include 'expire.php';


$_SESSION['price'] = $_POST['price'];
$_SESSION['product'] = $_POST['product'];
$_SESSION['quantity'] = $_POST['quantity'];

if(isset($_SESSION['myemail'])){
   header("Location:purchase.php");
}
else{
   header("Location:login.php");
}
?>

Ok. Im trying to set variables on page 1. Post them in hidden fields to page 2 which then lets me use them on page 3.

 

Page 1 is:

 

<form action="checkpurchase.php" method="post">

<input type="hidden" name="product" value="$product"><?php
$price = £59.99;
$product = Apple Ipod;
?>                    

<input type="hidden" name="price" value="$price">
<input type="hidden" name="product" value="$product">					
<input name="quantity" type="text" value="1" size="2" maxlength="2" />
    <input type="submit" name="submit" value="Buy"  />

 

 

 

 

Page 2 is:

<?php 
include 'sessionstartandsql.php';
include 'expire.php';


$_SESSION['price'] = $_POST['price'];
$_SESSION['product'] = $_POST['product'];
$_SESSION['quantity'] = $_POST['quantity'];

if(isset($_SESSION['myemail'])){
   header("Location:purchase.php");
}
else{
   header("Location:login.php");
}
?>

 

 

I just need code to echo out the variable on page 3.

 

 

 

So my goal:

 

Assign "£59.99" and "Apple Ipod" to seperate variables that i can echo out on page 3.

 

Snooble

 

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.