救命嘍

edited 十月 2013 in PHP新手區
大大
現在在寫 shopping cart 這個部份 
php +mysql


發現老師hand out 跟書上教的不一樣..

老師:

Add data to the databases
<?php
//.....create form to collect data to add to database
echo("<br><br>"); // the \ characters below = escape characters that process the "
echo("<form action = \"$PHP_SELF\" method=\"post\">");
// form self reference - POST method
echo("New student details<br>");
echo("Name <input type=\"text\" name=\"name\" ><br>");
// text box
$name=$_POST["name"];
echo("Sex <input type=\"text\" name=\"sex\" ><br>");
// text box
$sex=$_POST["sex"];
echo("Field <input type=\"text\" name=\"field\" ><br>");
// text box
$field=$_POST["field"];



書上是用上奇的

<?
session_start();
do_html_header("Checkout");
$firstname = $_POST;
$lastname = $_POST;
$address = $_POST;
$city = $_POST;
$postcoded = $_POST;
?>


<?function insert_order($order_details)
{extract($order_tails);
$conn = db_connect();
$query = "select customerID from customer where
firstName = '$firstname' and lastname ='$lastname' and
address = '$address' and city = '$city' and
postcode = 'postcode'";

$result = $conn->query($query);
?>

那我都試過..but..但沒有一個成功的
那要用那一個..
謝謝

原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=1515

評論

Sign In or Register to comment.