Jump to content

Recommended Posts

hi everyone...

im trying to get a confirmation of an order, but the file isnt working for some reason...

order.php takes the customer to confirmation.php after he fills in his details.

can anyone find the mistake?

---

 

<HTML>

<HEAD>

  <TITLE> Confirmation </TITLE>

<p align="right"><font>Prasen Rathore 1167618</font></p>

  <font size=5 color=red><CENTER>Order Confirmation Details</CENTER></font>

</HEAD>

 

<body bgcolor="#87CEFA">   

<?php

 

session_start();

 

$productID = $_SESSION['productID'];

 

print "product is  $productID<br>";

 

$conn=odbc_connect('IC2A207', '','');

if(!$conn){

exit("Connection Failed:" .$conn);

}

 

$orderID = "a1135813"."-".$productID;

$firstname = $_POST["firstname"];

print "first name is  $firstname<br>";

$lastname = $_POST["lastname"];

$noandstreet= $_POST["noandstreet"];

$city= $_POST["city"];

$state= $_POST["state"];

$postcode= $_POST["postcode"];

$phone= $_POST["phone1"].$_post["phone2"].$_post["phone3"];

$ccnumber= $_POST["ccnumber"];

$ccexpiry= $_POST["ccexpiry1"]. $_post["ccexpiry2"];

 

$sqlinsert="INSERT INTO customers (orderID, firstname,lastname,noandstreet,city,state,postcode,phone,ccnumber,ccexpiry)

VALUES ('$orderID','$firstname','$lastname','$noandstreet','$city','$state','$postcode','$phone','$ccnumber','$ccexpiry')";

print "insert statement is  $sqlinsert<br>";

$insertResult=odbc_exec($conn,$sqlinsert);

if(!insertResult)

{

print"Unsuccessful insertion".odbc_error();

}

else

{

print"Your orders are accepted.<br>";

}

 

print  "We confirm that we have recieved an order from $firstname ".$lastname." for the following product: ";

 

$sqlquery="SELECT * FROM products where productID='" .$productID."' ";

$rs=odbc_exec($conn,$sqlquery);

 

print "<table border=\"1\" align=\"center\"><tr>";

print "<th>ID</th>";

print "<th>Title</th>";

print "<th>Authors</th>";

print "<th>Date</th>";

print "<th>Edition</th>";

print "<th>ISBN</th>";

print "<th>Coverart</th>";

print "<th>Price</th>";

 

 

$ID=odbc_result($rs,"productID");

$Title=odbc_result($rs,"title");

$Authors=odbc_result($rs,"authors");

$Date=odbc_result($rs,"publishDate");

 

$Edition=odbc_result($rs,"edition");

$ISBN=odbc_result($rs,"isbn");

 

 

$Coverart=odbc_result($rs,"coverart");

$Price=odbc_result($rs,"price");

$Select=odbc_result($rs,"");

 

print"<tr><td>$productID</td>";

print"<td>$Title</td>";

print"<td>$Authors</td>";

print"<td>$Date</td>";

print"<td>$Edition</td>";

print"<td>$ISBN</td>";

print"<td><img src=\"$Coverart\"></td>";

print"<td>$Price</td>";

 

 

odbc_close($conn);

 

  ?>

</BODY>

</HTML>

 

 

Link to comment
https://forums.phpfreaks.com/topic/74683-confirmationphp/
Share on other sites

Please put your session start at the very start of the page

 

<?php 
            session_start();
?>
<HTML>
<HEAD>
  <TITLE> Confirmation </TITLE>
<p align="right"><font>Prasen Rathore 1167618</font></p>
  <font size=5 color=red><CENTER>Order Confirmation Details</CENTER></font>
</HEAD>

<body bgcolor="#87CEFA">     
<?php
            

            
            $productID = $_SESSION['productID'];

Link to comment
https://forums.phpfreaks.com/topic/74683-confirmationphp/#findComment-377576
Share on other sites

thanks... but its still the same...

i get...:

 

Order Confirmation Details

product is

first name is

insert statement is INSERT INTO customers (orderID, firstname,lastname,noandstreet,city,state,postcode,phone,ccnumber,ccexpiry) VALUES ('a1135813-','','','','','','','','','')

Your orders are accepted.

We confirm that we have recieved an order from for the following product: ID Title Authors Date Edition ISBN Coverart Price

       

 

Link to comment
https://forums.phpfreaks.com/topic/74683-confirmationphp/#findComment-377578
Share on other sites

here is order.php:

 

<HTML>

<HEAD>

<TITLE> Order </TITLE>

 

 

<script language="Javascript">

function checkform(myform) {

 

if(myform.firstname.value==""){

window.alert("Please complete firstname.");

return false;

}

 

if(myform.lastname.value== ""){

window.alert("Please complete lastname.");

return false;

}

 

if(myform.noandstreet.value== ""){

window.alert("Please complete your address.");

return false;

}

 

if(myform.city.value== ""){

window.alert("Please enter a city.");

return false;

}

 

 

if(myform.postcode.value==""){

window.alert("Please enter your postcode.");

return false;

}

 

 

if(myform.phone2.value== ""){

window.alert("Please complete your phone no.");

return false;

}

 

 

if(myform.phone3.value== ""){

window.alert("Please complete your phone no.");

return false;

}

 

if(myform.ccnumber.value== ""){

window.alert("Please enter your creditcard number.");

return false;

}

 

if(myform.ccexpiry1.value== ""){

window.alert("Please complete your creditcard's expiration date.");

return false;

}

 

if(myform.ccexpiry2.value== ""){

window.alert("Please complete your creditcard's expiration date.");

return false;

}

 

return true;

}

</script>

 

</HEAD>

 

<BODY bgcolor="#87CEFA"><FORM METHOD="POST" ACTION="confirmation.php" onsubmit="return checkform(this)">

<p align="right"><font>Prasen Rathore 1167618</font></p>

<H1 align="center">Check Out</H1><hr>

 

 

<B><font color=#6600CC><CENTER>Please fill out the following information</CENTER></B><BR><BR>

<h3 align="center">First name:     <INPUT NAME="firstname" TYPE="text"  Size="30"></h3>

<h3 align="center">Last name:     <INPUT NAME="lastname" TYPE="text"  Size="40"></h3>

<h3 align="center">Address:                  

Number and Street:         <INPUT NAME="noandstreet"TYPE="text"  Size="40"></h3>

<h3 align="center">City:                       <INPUT NAME="city" TYPE="text"  Size="40"></h3>

<h3 align="center">State: <select name="state">

<option select="option selected">SA</option>

<option>VIC</option>

<option>WA</option>

<option>NSW</option>

<option>QLD</option>

<option>TAS</option>

<option>NT</option>

<option>ACT</option></select></h3>

<h3 align="center">Postcode: <INPUT NAME="postcode" TYPE="text"  Maxlength="4" Size="6"></h3>

    <h3 align="center">Phone #: <INPUT NAME="phone1" TYPE="text"  Size="3" maxlength="2">  <INPUT NAME="phone2"TYPE="text"  Size="5" maxlength="4">  <INPUT NAME="phone3" TYPE="text"  Size="5" maxlength="4"></h3>

<h3 align="center">Credit Card # <INPUT NAME="ccnumber" TYPE="text"  Size="15"></h3>

<h3 align="center">Expiration Date: <INPUT NAME="ccexpiry1" TYPE="text"  Size="2"> / <INPUT NAME="ccexpiry2" TYPE="text"  Size="2"></h3>

<BR><BR><h3 align="center"> <INPUT TYPE="submit" VALUE="Submit">

<INPUT TYPE="reset" VALUE="Clear"></h3>

 

<?php

session_start();

$productID=$_POST["selected"];

$_SESSION['productID']=$productID;

 

?>

 

</FORM>

</BODY>

</HTML>

 

Link to comment
https://forums.phpfreaks.com/topic/74683-confirmationphp/#findComment-377587
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.