Check this picture
http://s11.postimg.org/5ukf21bcj/form2.png
Okay astonecipher, I have question:
I crated php site with sql database using Adobe Dreamwaver CSS 5
I have two tables are attached to my form, the first one is ITEMS, the second one ORDERS
Do u have idea how i will make it works? I did repeat region to display items in the form, but I could not make to read from the form using the same idea of repeat region.
I want make those fields placed on hidden filed orders using
[php][/php]
[php]
<?php require_once('Connections/connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO items (id, `order`) VALUES (%s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['order'], "text"));
mysql_select_db($database_connection, $connection);
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$insertGoTo = "orderCompleted.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_connection, $connection);
$query_orders = "SELECT * FROM items";
$orders = mysql_query($query_orders, $connection) or die(mysql_error());
$row_orders = mysql_fetch_assoc($orders);
$totalRows_orders = mysql_num_rows($orders);
mysql_select_db($database_connection, $connection);
$query_types = "SELECT itemstypes FROM itemstypes";
$types = mysql_query($query_types, $connection) or die(mysql_error());
$row_types = mysql_fetch_assoc($types);
$totalRows_types = mysql_num_rows($types);
?>
Jason's Online Market
Quantity |
Item |
Comment |
<?php do { ?>
|
<?php echo $row_types['itemstypes']; ?> |
|
<?php } while ($row_types = mysql_fetch_assoc($types)); ?>
|
|
|
<?php
mysql_free_result($orders);
mysql_free_result($types);
?>
[/php]