Jump to content

show form if database value == 10 or show another if value ==20


MsKazza

Recommended Posts

Hi :) ,

 

I know my code sucks but i'm learning fast!! I'm trying to show a form if the qty value in a database == 10 or a different form if the value ==20.  I tried but failed.  Any help really appreciated.

 


<?php require_once('Connections/book.php'); ?>
<?php
$colname_cardpayment = "-1";
if (isset($_GET['orderid'])) {
  $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']);
}
mysql_select_db($database_book, $book);
$query_cardpayment = sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment);
$cardpayment = mysql_query($query_cardpayment, $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

// Database connect
$con = mysql_connect("mysql1.myhost.ie","admin_book","root123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("book_test", $con);


//Parse Values from Coupon.php Form
$orderid = mysql_real_escape_string(trim($_POST['orderid']));
$name  = mysql_real_escape_string(trim($_POST['name']));
$surname  = mysql_real_escape_string(trim($_POST['surname']));
$add1 = mysql_real_escape_string(trim($_POST['add1']));
$add2 = mysql_real_escape_string(trim($_POST['add2']));
$town = mysql_real_escape_string(trim($_POST['town']));
$county = mysql_real_escape_string(trim($_POST['county']));
$postcode = mysql_real_escape_string(trim($_POST['postcode']));
$phone = mysql_real_escape_string(trim($_POST['phone']));
$email = mysql_real_escape_string(trim($_POST['email']));
$letterstyle = mysql_real_escape_string(trim($_POST['letterstyle']));


$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle)
VALUES
('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')";

if (!mysql_query($sql))
  {
  die('Error: ' . mysql_error());
  }
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $orderid . '.<br />';

if ($row2['qty'] == 10)
    echo "<div>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="accounts@agraphics.ie">
<input type="hidden" name="lc" value="IE">
<input type="hidden" name="item_name" value="10 Christmas Cards">
<input type="hidden" name="item_number" value="<? echo $orderid; ?>">
<input type="hidden" name="amount" value="12.99">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="shipping" value="2.99">
<input type="hidden" name="return" value="http://www.digitalscribe/thanks.php">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>";

if ($row2['qty'] == 20)
    echo "<div>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="accounts@agraphics.ie">
<input type="hidden" name="lc" value="IE">
<input type="hidden" name="item_name" value="20 Christmas Cards">
<input type="hidden" name="item_number" value="<? echo $orderid; ?>">
<input type="hidden" name="amount" value="21.99">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="shipping" value="2.99">
<input type="hidden" name="return" value="http://www.digitalscribe/thanks.php">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>";


?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

Link to comment
Share on other sites

Hi :) ,

 

I know my code sucks but i'm learning fast!! I'm trying to show a form if the qty value in a database == 10 or a different form if the value ==20.  I tried but failed.  Any help really appreciated.

 

Ordinarily, I would tell you what is wrong and wish you well. However, since you say you're learning and I have some time, I rewrote it for you.  Firstly, when you echo HTML inside a PHP echo statement you have to pay attention to your quoting.  If your echo statement looks like echo 'some text', then any single quotes inside that echo statement must be escaped with a single backslash ( \ ). The same holds true if your echo statement uses double quotes, echo "this is cool". If you don't escape the quote, then PHP thinks that is where the echo statement closes, not that you want to echo the literal value of the quote.

 

Additionally, you can use mixed quoting.

<?php
echo "<span style='color: red;'>This is a test</span>"
//NOTICE THAT I CAN USE SINGLE QUOTES WITHOUT ESCAPING THEM, BECAUSE I OPEN AND CLOSE THE ECHO WITH DOUBLE QUOTES
?>

 

So, you're next question, what's the difference between the double and single quote? The single quote simply evaluates everything as literal text. The double quote will do the same however, it will echo the inferred value of variables rather than the literal variables.

 

<?php

$a = 123;
echo '$a';     //THIS WILL ECHO $a
echo "$a";   //THIS WILL ECHO 123
?>

 

I also rewrote some of your logic at the top, particularly, look at how I did the foreach loop that replaces all those mysql_real_esacpe(trim()) statements that you had.

 

Here is your code:

<?php 

require_once('Connections/book.php'); 
$colname_cardpayment = "-1";

if (isset($_GET['orderid'])) {
  $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']);
}
mysql_select_db($database_book, $book);
$cardpayment = mysql_query(sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle)
VALUES
('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')";

if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $orderid . '.<br />';

if ($row2['qty'] == 10)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name="business" value="accounts@agraphics.ie">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"10 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"12.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";

if ($row2['qty'] == 20)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"20 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"21.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\"shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";
?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

Link to comment
Share on other sites

Thank you for your response.

 

when i tried that code i got this error:

 

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

 

I left one of the lines un-escaped, to see if you would find it:

<input type=\"hidden\" name="business" value="accounts@agraphics.ie">

 

That results in a parse error. Most servers will echo PHP errors, your server, seems to be configured differently. Below is the code, with the line, escaped.

 

<?php 

require_once('Connections/book.php'); 
$colname_cardpayment = "-1";

if (isset($_GET['orderid'])) {
  $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']);
}
mysql_select_db($database_book, $book);
$cardpayment = mysql_query(sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle)
VALUES
('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')";

if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $orderid . '.<br />';

if ($row2['qty'] == 10)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"10 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"12.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";

if ($row2['qty'] == 20)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"20 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"21.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\"shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";
?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

Link to comment
Share on other sites

:-[

sorry i normally do check my code, was just so excited to see it work.  been working on this site for a while.  i'll make sure to check and double check everything in future so i don't make any more silly post/mistakes

lol :)

 

It's okay .... just remember, you will never learn as much as when you have to find the problem on your own. I like to help people learn, not just solve their problems - all I ask is that you pay it forward

Link to comment
Share on other sites

ok i must be missing something, well i must have done it wrong.  i'm trying to look up a record with orderid = 32343255 (e.g.) and from that record check if the qty is either 10 or 20 then depending on that display the correct div.  i now just get a blank page.  even the echo 'Order ID is :  '. $orderid . '.<br />'; is blank.  also one more quick question: why is colname_cardpayment = -1?

believe me i pay it forward, have been teaching my sister all she needs to know to do my perfect job, its for her that i'm doing this page :)  and i love trying to solve problems, i can sit for hours trying to get something to work.  normally i would have done this myself, only my sister needs this for tomorrow.  but like u say i much rather someone point me in the right direction and i learn it myself.  thought i was doing quite well too, i've self taught myself everything i know so far in the last few months.  loving php :)

Link to comment
Share on other sites

i must sound like such a ditz, sorry.  i used dreamweaver to create the recordset, guess should have done it myself, was trying to save time.  the site is digitalscribe.ie the option for cards.  don't want the user to see two buy now buttons, i thought would be a simple if else statement if qty ==10 then show top div else show other one.  but have to first filter the orderid to the one in post

Link to comment
Share on other sites

i must sound like such a ditz, sorry.  i used dreamweaver to create the recordset, guess should have done it myself, was trying to save time.  the site is digitalscribe.ie the option for cards.  don't want the user to see two buy now buttons, i thought would be a simple if else statement if qty ==10 then show top div else show other one.  but have to first filter the orderid to the one in post

 

Okay, lets work through this.

 

Lets start here:

 

mysql_select_db($database_book, $book);
$cardpayment = mysql_query(sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

 

1.) It would seem that you are trying to setup two database connections here, but you're only actually making one connection, to the book_test database.  What is the other mysql_select_db() ($database_book) for?

 

2.) It seems that your code is checking the value of $row2['qty'] to determine which form to show; however, in the code, $row2['qty'] isn't referenced anywhere. So, the reason that neither form is echo'ed out, is because $row2['qty'], doesn't equal 10 or 20.

Link to comment
Share on other sites

ok, i've cleaned it up a bit, taken out the other db connect.  and made some changes to the $row2 bit

 

<?php 

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);



//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle)
VALUES
('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')";

$cardpayment = mysql_query(sprintf("SELECT qty FROM cards WHERE orderid = $orderid"), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);


if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $orderid . '.<br />';

if ($qty == 10)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"10 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"12.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";

if ($qty == 20)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"20 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"21.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\"shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";
?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

 

i still get a blank page, and when i check source there is nothing there either

Link to comment
Share on other sites

Okay, looks much cleaner!

 

I found a few more syntax/logic issues, here is the corrected code:

 

<?php 

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) VALUES ('" . $_POST['orderid'] . "','" . $_POST['name'] . "','" . $_POST['surname'] . "','" . $_POST['add1'] . "','" . $_POST['add2'] . "','" . $_POST['town'] . "','" . $_POST['country'] . "','" . $_POST['postcode'] . "','" . $_POST['phone'] . "','" . $_POST['email'] . "','" . $_POST['letterstyle'] . "')";

$cardpayment = mysql_query(sprintf("SELECT qty FROM cards WHERE orderid = " . $_POST['orderid']), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);


if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $_POST['orderid'] . '.<br />';

if ($qty == 10)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"10 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"12.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";

if ($qty == 20)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"20 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"21.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\"shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";
?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

 

Now, where is the $qty variable being set? The $qty variable is what will determin which form (if any) will be shown.

Link to comment
Share on other sites

i thought the qty was being taken from the recordset ($cardpayment = mysql_query(sprintf("SELECT qty FROM cards WHERE orderid = " . $_POST['orderid']), $book) or die(mysql_error());)

 

but then i guess that is only retrieving it, i need to set the variable afterwards?

Link to comment
Share on other sites

so like this?

 

<?php 

//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) VALUES ('" . $_POST['orderid'] . "','" . $_POST['name'] . "','" . $_POST['surname'] . "','" . $_POST['add1'] . "','" . $_POST['add2'] . "','" . $_POST['town'] . "','" . $_POST['country'] . "','" . $_POST['postcode'] . "','" . $_POST['phone'] . "','" . $_POST['email'] . "','" . $_POST['letterstyle'] . "')";

$cardpayment = mysql_query(sprintf("SELECT qty FROM cards WHERE orderid = " . $_POST['orderid']), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

$qty = $row_cardpayment;

if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

 

it still gives me a blank page

Link to comment
Share on other sites

so.... like this?  $qty = array($row_cardpayment);

 

i get the following errors:

 

Notice: Undefined index: country in /var/www/vhosts/digitalscribe.ie/httpdocs/card_paynow.php on line 15

 

Notice: Undefined index: letterstyle in /var/www/vhosts/digitalscribe.ie/httpdocs/card_paynow.php on line 15

 

Notice: Undefined variable: book in /var/www/vhosts/digitalscribe.ie/httpdocs/card_paynow.php on line 17

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/vhosts/digitalscribe.ie/httpdocs/card_paynow.php on line 17

Link to comment
Share on other sites

Here is your first problem:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/vhosts/digitalscribe.ie/httpdocs/card_paynow.php on line 17

 

the connecting resource you are using in mysql_query is no good. You need to establis a connection first, before you can run a query.

Link to comment
Share on other sites

thank you so much for all your help so far tonight, unfortunately its 1.18am over here so i'll have to continue on tomorrow.  You've really been a great help and i really appreciate being able to learn like this.  i'll try figure out the connection problem in the morning.

:) thanks again

MsKazza

Link to comment
Share on other sites

ok, i'm really stuck now and running out of time.  can someone please tell me what i've done wrong i thought the connection had been made in the db connect code. 

 

<?php 
ini_set('display_errors', 1);
//Database connect
if (!$con = mysql_connect("mysql1.myhost.ie","admin_book","root123")) {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("book_test", $con);

//CLEAN POST VALUES
foreach ($_POST as $k=>$v) {
$_POST[$k] = mysql_real_escape_string(trim($v));
}

$sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) 
VALUES ('" . $_POST['orderid'] . "','" . $_POST['name'] . "','" . $_POST['surname'] . "','" . $_POST['add1'] . "','" . $_POST['add2'] . "','" . $_POST['town'] . "','" . $_POST['country'] . "','" . $_POST['postcode'] . "','" . $_POST['phone'] . "','" . $_POST['email'] . "','" . $_POST['letterstyle'] . "')";

$cardpayment = mysql_query(sprintf("SELECT qty FROM cards WHERE orderid = " . $_POST['orderid']), $book) or die(mysql_error());
$row_cardpayment = mysql_fetch_assoc($cardpayment);
$totalRows_cardpayment = mysql_num_rows($cardpayment);

$qty = array($row_cardpayment);

if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Digital Scribe Books</title>
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
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_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_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/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')">


<div id="snow">
<div id="wrapper">


<div id="header">

<div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div>


<div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div>
</div>




<div id="content">



<?php 
echo 'Order ID is :  '. $_POST['orderid'] . '.<br />';

if ($qty == 10)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"10 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"12.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";

if ($qty == 20)
    echo "<div>

<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"accounts@agraphics.ie\">
<input type=\"hidden\" name=\"lc\" value=\"IE\">
<input type=\"hidden\" name=\"item_name\" value=\"20 Christmas Cards\">
<input type=\"hidden\" name=\"item_number\" value=\"$orderid\">
<input type=\"hidden\" name=\"amount\" value=\"21.99\">
<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">
<input type=\"hidden\" name=\"button_subtype\" value=\"services\">
<input type=\"hidden\" name=\"shipping\" value=\"2.99\">
<input type=\"hidden\" name=\"return\" value=\"http://www.digitalscribe/thanks.php\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">
<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">
<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">
</form>
</div>";
?>

</div>


<div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br />
Books</div>
</div></div>

</div></div>






</body>
</html>
<?php
mysql_free_result($cardpayment);
?>

Link to comment
Share on other sites

  • 2 weeks later...

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.