[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

$id value doesnt carry through redirected page

Posted on 2006-03-24
8
Medium Priority
?
531 Views
Last Modified: 2013-12-12
Hi,

Im using the following page to carry form data over to a payment page:

<?php
session_start();
header("Cache-control: private");
include 'db.php';


$id = $_POST['id'];
$price = $_POST['price'];

$uname=$_SESSION['uname'];
?>
<?php function redirect($url)
{
    echo '<script language="JavaScript">
    document.location.href="' . $url . '"
    </script>';
    echo "If you do not get redirected <a href=\"" . $url . "\">click here</a>.";
}
?>
<?php
$isError=false;
$error_firstname=$error_surname=$error_yob=$error_street1=$error_street2=$error_tow=$error_city=$error_phone=$country="";
$dob=$mob=1;
$email=$firstname=$surname=$yob=$street1=$street2=$town=$city=$phone="";

if (isset($_POST["submit_x"]) && $_POST["submit_x"])
{
     foreach ($_POST as $key => $value)
          $$key = $value;

     if (strlen($firstname) < 3) {
          $isError = true;
          $error_firstname = "<img src='images/error.gif'>";
     }

     if (strlen($surname) < 3) {
          $isError = true;
          $error_surname = "<img src='images/error.gif'>";
     }

     if (strlen($yob) < 4) {
          $isError = true;
          $error_yob = "<img src='images/error.gif'>";
     }

     if (strlen($street1) < 3) {
          $isError = true;
          $error_street1 = "<img src='images/error.gif'>";
     }

     if (strlen($street2) < 3) {
          $isError = true;
          $error_street2 = "<img src='images/error.gif'>";
     }

     if (strlen($town) < 3) {
          $isError = true;
          $error_town = "<img src='images/error.gif'>";
     }

     if (strlen($city) < 3) {
          $isError = true;
          $error_city = "<img src='images/error.gif'>";
     }

     if (strlen($phone) < 3) {
          $isError = true;
          $error_phone = "<img src='images/error.gif'>";
     }

   

     if(!$isError)
     {
          //process form
          $_SESSION = $_POST;
          redirect("https://www.templateit.net/safepayment.php");
          exit;
     }



?>

<?php
//email function
function validate_email($str)
{
     $str = strtolower($str);
     if(ereg("^([^[:space:]]+)@(.+)\.(ad|ae|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|fx|ga|gb|gov|gd|ge|gf|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nato|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$",$str))
     {
          return 0;
     } else {
          return 1;
     }
}
 }
?>
<?php
if (!$submit || !$submit_x || $isError)
{
?>
<html>
<head>
<title>Purchase - Payment Details::</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<LINK HREF="style.css" TYPE="text/css" REL="stylesheet">
<style type="text/css">
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body onLoad="MM_preloadImages('images/dw_butt_on.jpg','images/imode_butt_on.jpg','images/flash_butt_on.jpg','images/css_butt_on.jpg')">
<div id="Layer1"></div>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/til_2.jpg" style="background-repeat:repeat-x; background-position:top ">&nbsp;</td>
    <td width="766" align="left" valign="top"><table width="766"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr align="left" valign="top">
            <td width="541" height="234"><img src="images/top_1.jpg" width="541" height="234"></td>
            <td width="225"><table width="225"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="102" align="left" valign="top" background="images/back_1.jpg" class="style1"><label></label></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="530" height="132" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="106" height="130" title="menu">
                      <param name="movie" value="flash/menu.swf">
                      <param name="quality" value="high">
                      <embed src="flash/menu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="106" height="130"></embed>
                    </object></td>
                    <td width="119"><img src="images/top_2.jpg" width="119" height="132"></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td width="372" rowspan="3" align="left" valign="top"><p>
            <label></label>
            <span class="HedingText">Puchase Your Template </span></p>
          <p class="style3">To complete the purchase of your product simply fill out the form to the right of this page. Before you do so you should review the details of your purchace below and ensure that you have read the terms and conditions. </p>
          <p class="style3">On confirmation of your purchase you will also be presented with a download dialog. Download times are dependant upon the speed of your connection. Should you have any problems simply visit the <a href="support.php">customer support</a> area. </p>
          <p>
            <?php
echo "Product ID: "."$id"."<br />";
echo "Charge: "."$price"."<br />";
?>
          Terms and conditions go here</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p></td>
        <td width="13" rowspan="3" align="left" valign="top">

        <td width="381" height="90" align="left" valign="top"><span class="style5">Please confirm your personal details below
          </span>
          <p>
            <?php
            $sql = mysql_query('SELECT * FROM users WHERE username = \''.$uname.'\'');
            while($row = mysql_fetch_array($sql))
               {
                    echo "Email: ".$row['email'];
               }
               
                         ?>
            <br><form name="form1" method="post" action="<?php echo $PHP_SELF ?>">
            <table width="61%" border="0">
                            <tr>
                              <td width="23%">&nbsp;</td>
                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Firstname</font></td>
                              <td width="46%"> <span class="warninngtxt">
                              <input name="firstname" type="text" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'" value="<?=$firstname?>">
                              </span></td>
                              <td width="7%" class="warninngtxt"><?=$error_firstname?></td>
                            </tr>
                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Surname</font></td>
                              <td width="46%"> <span class="warninngtxt">
                              <input name="surname" type="text"  class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'"value="<?=$surname?>">
                              </span></td>

                              <td width="7%" class="warninngtxt"><?=$error_surname ?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Date of Birth</font></td>
                              <td width="46%"> <span class="warninngtxt">
                                <select name="dob" class="textBoxNormal" id="dob">
                                        <?
                                             for ($i=1; $i<=31; $i++)
                                             {
                                                  $s = ($i==(int)$dob) ? " selected=\"selected\"" : "";
                                                  $display = ($i<10?"0".$i:$i);
                                                  echo "<option value=\"$display\"$s>$display</option>\r\n";
                                             }
                                        ?>
                                </select>

                              <select name="mob" class="textBoxNormal" id="mob">
                                        <?
                                             for ($i=1; $i<=12; $i++)
                                             {
                                                  $s = ($i==(int)$mob) ? " selected=\"selected\"" : "";
                                                  $display = ($i<10?"0".$i:$i);
                                                  echo "<option value=\"$display\"$s>$display</option>\r\n";
                                             }
                                        ?>

                              </select>

                              <input name="yob" type="text" class="textBoxNormal" id="yob"  value="<?=$yob?>" size="4" maxlength="4">
                              </span></td>
                              <td width="7%" class="warninngtxt"><?=$error_yob?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Street</font></td>
                              <td width="46%"> <span class="warninngtxt">
                              <input name="street1" type="text" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'" value="<?=$street1?>">
                              </span></td>
                              <td width="7%" class="warninngtxt"><?=$error_street1 ?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><span class="NormalTxt">Line 2</span> </td>

                              <td width="46%"> <span class="warninngtxt">

                              <input name="street2" type="text"  class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'"value="<?=$street2?>">
                              </span></td>

                              <td width="7%" class="warninngtxt"><?=$error_street2 ?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Town</font></td>

                              <td width="46%"> <span class="warninngtxt">

                              <input name="town" type="text"class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'"  value="<?=$town?>">
                              </span></td>

                              <td width="7%" class="warninngtxt"><?=$error_town?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font

face="Times New Roman, Times, serif" class="NormalTxt">City</font></td>

                              <td width="46%"> <span class="warninngtxt">

                              <input name="city" type="text"  class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'"value="<?=$city?>">
                              </span></td>

                              <td width="7%" class="warninngtxt"><?=$error_city ?></td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font

face="Times New Roman, Times, serif" class="NormalTxt">Country</font></td>

                              <td width="46%"> <span class="warninngtxt">

                                <select name="country" size="1" class="textBoxNormal">
                                        <?
                                             $country_array = array ("Ireland","Afganishtan","Albania","Algeria","American Samoa","Andorra","Anguilla","Antartica","Antigua & Barbuda","Argentina","Armenia");
                                             //you can get this from your DB.
                                             for ($i=0; $i<count($country_array); $i++)
                                             {
                                                  $s = ($country_array[$i]==$country) ? " selected=\"selected\"":"";
                                                  echo "<option value=\"".$country_array[$i]."\"$s>".$country_array[$i]."</option>";
                                             }
                                        ?>
                                </select>

                              </span></td>

                              <td width="7%">&nbsp;</td>
                            </tr>

                            <tr>

                              <td width="23%">&nbsp;</td>

                              <td width="24%" class="warninngtxt"><font face="Times New Roman, Times, serif" class="NormalTxt">Phone</font></td>

                              <td width="46%"> <span class="warninngtxt">
                              <input name="phone" type="text" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'"value="<?=$phone?>">
                              </span></td>

                              <td width="7%" class="warninngtxt"><?=$error_phone?></td>
                            </tr>
              </table>
          </p>
               <input name="id" id="id" type="hidden" value= "<?php echo "$id"; ?>">
               <input name="price" id="price" type="hidden" value= "<?php echo "$price"; ?>"><p>
            <label><input type="image" src="images/submit_button.jpg" align="absmiddle" border="0" name="submit"></label>
            </form>
           </p>
      <tr>
        <td height="34" align="left" valign="top">
      <tr>
        <td height="266" align="left" valign="top">&nbsp;</td>
      </tr>

      <tr>
        <td height="37" colspan="3" align="left" valign="top"><img src="images/line_1.jpg" width="766" height="5"></td>
      </tr>
      <tr>
        <td colspan="3" align="center" valign="top"><div align="center" class="style3" style="padding-top:12px "><a href="index.php" style="color:#6A8BA4 ">About Us&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" class="style3">&nbsp;Products</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;<a href="index.php">&nbsp;Members</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" class="style3">Register</a><a href="index.php">&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" style="color:#6A8BA4 ">Contact Us</a><a href="index.php" style="color:#6A8BA4 "> </a></div>
          <div style="padding-left:0px; padding-top:8px"><a href="index-5.html" class="style3" style="text-decoration:none ">Copyright © templateit.net, 2005. All Rights Reserved</a></div></td>
      </tr>
    </table></td>
    <td background="images/til_2.jpg" style="background-position:top; background-repeat:repeat-x ">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td width="766" align="left" valign="top">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
 }

 // end if
?>
</body>
</html>


and the page that it is redirecting to is as follows:
<?php
session_start();
$email = $_POST['email'];

$firstname = $_POST['firstname'];

$surname = $_POST['surname'];

$uname = 'TEST';

$id = $_POST['id'];

$dob = $_POST['dob'];

$mob = $_POST['mob'];

$yob = $_POST['yob'];

$street1 = $_POST['street1'];

$street2 = $_POST['street2'];

$town = $_POST['town'];

$city = $_POST['city'];

$country = $_POST['country'];

$C_CcType = $_POST['C_CcType'];

$C_CcNum = $_POST['C_CcNum'];

$C_ExpD = $_POST['C_ExpD'];

$C_Sec = $_POST['C_Sec'];;

?>
<?php echo "$id";?>

<html>
<head>
<title>Secure Payment Screen</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<LINK HREF="style.css" TYPE="text/css" REL="stylesheet">
<style type="text/css">
<!--
#Layer1 {
      position:absolute;
      left:691px;
      top:-7px;
      width:0px;
      height:29px;
      z-index:1;
}
#Layer2 {
      position:absolute;
      left:702px;
      top:5px;
      width:101px;
      height:28px;
      z-index:2;
}
#Layer3 {
      position:absolute;
      left:130px;
      top:252px;
      width:278;
      height:136;
      z-index:2;
      background-repeat: no-repeat;
      background-image: url(images/bg_register.gif);
}
#Layer4 {
      position:absolute;
      left:129px;
      top:463px;
      width:350;
      height:130;
      z-index:3;
}
#Layer5 {
      position:absolute;
      left:535px;
      top:252px;
      width:302;
      height:202;
      z-index:4;
      background-image: url(images/bg_product_browse.gif);
}
#Layer6 {
      position:absolute;
      left:506px;
      top:463px;
      width:332;
      height:167;
      z-index:5;
      background-image: url(images/bg_search.gif);
    background-repeat: no-repeat;

}
#Layer7 {
      position:absolute;
      left:129px;
      top:599px;
      width:350px;
      height:31px;
      z-index:6;
      background-color: #CCCCCC;
}
#Layer8 {
      position:absolute;
      left:135px;
      top:471px;
      width:314;
      height:204;
      z-index:5;
}
#Layer9 {
      position:absolute;
      left:130;
      top:252;
      width:278px;
      height:136px;
      z-index:2;
      background-image: url(images/bg_register.gif);
      background-repeat:no-repeat;
}
#Layer10 {
      position:absolute;
      left:130px;
      top:399px;
      width:278;
      height:136;
      z-index:3;
      background-image: url(images/bg_register.gif);
      background-repeat:no-repeat;
      
}
#Layer11 {
      position:absolute;
      left:455px;
      top:324px;
      width:278;
      height:136;
      z-index:4;
      background-image: url(images/bg_login.jpg);
      background-repeat:no-repeat;
}

-->
</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('images/dw_butt_on.jpg','images/imode_butt_on.jpg','images/flash_butt_on.jpg','images/css_butt_on.jpg')">
<div id="Layer1"></div>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/til_2.jpg" style="background-repeat:repeat-x; background-position:top ">&nbsp;</td>
    <td width="766" align="left" valign="top"><table width="766"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr align="left" valign="top">
            <td width="541" height="234"><img src="images/top_1.jpg" width="541" height="234"></td>
            <td width="225"><table width="225"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="102" align="left" valign="top" background="images/back_1.jpg" class="style1"><label></label></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="530" height="132" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="106" height="130" title="menu">
                      <param name="movie" value="flash/menu.swf">
                      <param name="quality" value="high">
                      <embed src="flash/menu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="106" height="130"></embed>
                    </object></td>
                    <td width="119"><img src="images/top_2.jpg" width="119" height="132"></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td width="372" rowspan="3" align="left" valign="top"><p>
            <label></label>
          </p>
          <p><form name="form1" method="post" action="register1.php">
                      <p align="center">&nbsp;</p>
                      <p align="center" class="style2"><strong>Please Enter
                          the following details to complete your order </strong></p>
        <p align="center" class="style1 ver11">
                        <input name="email" type="hidden" id="email" value="<?php echo $email; ?>">
                        <input name="fname" type="hidden" id="firstname" value="<?php echo $firstname; ?>">
                        <input name="surname" type="hidden" id="surname" value="<?php echo $surname; ?>">
                        <input name="dob" type="hidden" id="dob" value="<?php echo $dob; ?>">
                        <input name="mob" type="hidden" id="mob" value="<?php echo $mob; ?>">
                        <input name="yob" type="hidden" id="yob" value="<?php echo $yob; ?>">
                        <input name="street1" type="hidden" id="street1" value="<?php echo $street1; ?>">
                        <input name="street2" type="hidden" id="street2" value="<?php echo $street2; ?>">
                        <input name="town" type="hidden" id="town" value="<?php echo $town; ?>">
                        <input name="city" type="hidden" id="city" value="<?php echo $city; ?>">
                        <input name="phone" type="hidden" id="phone" value="<?php echo $phone; ?>">
                        <input name="country" type="hidden" id="country" value="<?php echo $country; ?>">
                                  <input name="id" type="hidden" id="id" value="<?php echo $id; ?>">
          </p>
                      <p align="center" class="style1"><b><font color="#FF0000">Payment Details</font></b></p>
                     
        <table width="69%">
          <?
 if(isset($_GET['payment_error']) and $_GET['payment_error']!=''){
      echo "<TR><TD COLSPAN=2><font color=\"#FF0000\" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>ERROR: ".$_GET['payment_error']."</b></font></TD></TR>";
  }
  ?>
          <tr>
            <td width="10%" rowspan="4">&nbsp;</td>
            <td width="39%" height="26"><span class="NormalTxt"></span><span class="NormalTxt">Card
              Type</span><span class="NormalTxt">:</span></td>
            <td width="51%"> <select name="C_CcType" class="textBoxNormal" id="select2">
                <option selected value="1">Visa</option>
                <option value="2">MasterCard</option>
                <option value="3">American Express</option>
              </select> </td>
          </tr>
          <tr>
            <td width="39%" height="24"><span class="NormalTxt">Card Number:</span></td>
            <td width="51%"> <input type="text"  autocomplete="off" name="C_CcNum" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'">
            </td>
          </tr>
          <tr>
            <td width="39%" height="42" class="NormalTxt">Expiry Date:</td>
            <td width="51%"> <input type="text" name="C_ExpD" autocomplete="off" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'">
              <span class="NormalTxt">eg: 06/06 </span> </td>
          </tr>
          <tr>
            <td width="39%" height="24" class="NormalTxt">Sec Code:</td>
            <td width="51%"> <input type="text" autocomplete="off"  name="C_Sec" class="textBoxNormal" onFocus="this.className='textBoxActive'" onBlur="this.className='textBoxNormal'">
            </td>
          </tr>
          <tr>
            <td height="24" colspan="3"><div align="right">
              <input type="image" src="images/submit_button.jpg" align="middle" border="0" name="image">
              </div></td>
          </tr>
        </table>
                      <p align="center" class="tahbol style1">
                        <input name="total" type="hidden" id="total" value="<?php echo $total; ?>">
                        <input name="p_method" type="hidden" id="p_method" value="<?php echo $p_method; ?>">
                      </p>
                      <p>&nbsp;</p>
                      <p>
    </form>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p></td>
        <td width="394" height="86" align="left" valign="middle"><a href="http://www.pixelscience.it"></a></td>
      </tr>
      <tr>
        <td height="113" align="left" valign="top" class="style3"><div align="center"></div></td>
      </tr>
      <tr>
        <td align="left" valign="top">&nbsp;</td>
      </tr>
     
      <tr>
        <td height="37" colspan="2" align="left" valign="top"><img src="images/line_1.jpg" width="766" height="5"></td>
      </tr>
      <tr>
        <td colspan="2" align="center" valign="top"><div align="center" class="style3" style="padding-top:12px "><a href="index.php" style="color:#6A8BA4 ">About Us&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" class="style3">&nbsp;Products</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;<a href="index.php">&nbsp;Members</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" class="style3">Register</a><a href="index.php">&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php" style="color:#6A8BA4 ">Contact Us</a><a href="index.php" style="color:#6A8BA4 "> </a></div>
          <div style="padding-left:0px; padding-top:8px"><a href="index-5.html" class="style3" style="text-decoration:none ">Copyright © templateit.net, 2005. All Rights Reserved</a></div></td>
      </tr>
    </table></td>
    <td background="images/til_2.jpg" style="background-position:top; background-repeat:repeat-x ">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td width="766" align="left" valign="top">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
     <?php

 // end if

?>
</body>
</html>

The problem im having is with the $id isnt passing from the purchase2.php page to the payment page and i cant figure put why as all the other values are passing over no problems.

Apologies for the mass of code, Ive only posted all of it due to the fact that the forms are using hidden fields and are all part of the problem here i think.... is $id ok to use or is it reserved or anything?

0
Comment
Question by:clonmelog
  • 4
  • 2
  • 2
8 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 16282544
Might be fatigue, but I don't see id anywhere outputted in a input field or so.

Have you tried adding a hidden input?

<form name="form1" method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($id);?>"/>

-r-
0
 
LVL 2

Author Comment

by:clonmelog
ID: 16282603
yes, i have it in there towards the bottom of the form:

<input type="hidden" name="id" value="<?php echo htmlspecialchars($id);?>"/>
               <input name="price" id="price" type="hidden" value= "<?php echo "$price"; ?>"><p>
            <label><input type="image" src="images/submit_button.jpg" align="absmiddle" border="0" name="submit"></label>
            </form>

ive just tried adding on your htmlspecialchars code also but no luck there :(
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 16282656
Do you see the id when doing view source from your browser on the first page?

-r-
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Author Comment

by:clonmelog
ID: 16282746
on purchase 2.php yes the value does display.... thats why i find this strange. is it something to do with the fact that im applying a javascript redirect in the code or should that effect things at all?
0
 
LVL 7

Expert Comment

by:Lhotch
ID: 16284841
I dont beleive the redirect is going to carry with it any post information. You could try appending the $id to the URL and use $_GET or $_REQUEST to retrieve it.....or write it to a session and retrieve it via $_SESSION and when all done destroy the session.
0
 
LVL 2

Author Comment

by:clonmelog
ID: 16285628
>>>> I dont beleive the redirect is going to carry with it any post information. You could try appending the $id to the URL and use $_GET or $_REQUEST to retrieve it.....or write it to a session and retrieve it via $_SESSION and when all done destroy the session.


How would I code such a thing with a $_session and at what point should it be destroyed?
0
 
LVL 7

Accepted Solution

by:
Lhotch earned 2000 total points
ID: 16285723
For sessions, if your calling session_start() at the top of each script you can get the value of $id from the 1st time its posted via a form and then instead of assigning $id the value $_POST['id'] like you did, assign it to a session variable instead like this. $_SESSION['id'] = $_POST['id'].

Then on the page that was redirected to make sure you call session_start() as the 1st line and after that of you need the value of id you can reference it via $_SESSION['id'].

destroy the session with session_destroy() when the user is done submitting info and you no longer need the variable.

To pass along the id in the URL you should be able to add it to your function call.

redirect("https://www.templateit.net/safepayment.php?id=$id");

Then on the page your redirected to you can access it with $_REQUEST['id'] or $_GET['id']  
0
 
LVL 2

Author Comment

by:clonmelog
ID: 16288133
worked great,

thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month19 days, 4 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question