•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,349 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,264 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 523 | Replies: 2
![]() |
•
•
Join Date: Jul 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 1
Problem : i have three forms on three different files, personal_details, property_details and payment. After clicking the submit button on the personal details form the property details form opens as expected but upon clicking the submit form button on the property details form the payment form does not open.
If there's a way out i would appreciate this very much
the files are as follows;
personal details
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 personaldetails (regID, firstname, lastname, sex, stateoforigin, email, telephone, username, password, useraccess) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['regID'], "int"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['lastname'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['stateoforigin'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['telephone'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['useraccess'], "text"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "property_details.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
property details
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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"] == "form2")) {
$insertSQL = sprintf("INSERT INTO propertydetails (propertyID, price, regID, cooNo, propType, intent, numofrooms, address, `state`, lga) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['propertyID'], "int"),
GetSQLValueString($_POST['price'], "int"),
GetSQLValueString($_POST['regID'], "text"),
GetSQLValueString($_POST['cooNo'], "text"),
GetSQLValueString($_POST['proptype'], "text"),
GetSQLValueString($_POST['intent'], "text"),
GetSQLValueString($_POST['numofrooms'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['lga'], "text"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "payment.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
payment
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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"] == "form3")) {
$insertSQL = sprintf("INSERT INTO payment (paymentID, propertyID, cardType, `number`, securitycode, postcode, cardexp, email, regID) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['paymentID'], "int"),
GetSQLValueString($_POST['propertyID'], "int"),
GetSQLValueString($_POST['cardType'], "text"),
GetSQLValueString($_POST['number'], "int"),
GetSQLValueString($_POST['securitycode'], "int"),
GetSQLValueString($_POST['postcode'], "text"),
GetSQLValueString($_POST['cardexp'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['regID'], "int"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "logging.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
If there's a way out i would appreciate this very much
the files are as follows;
personal details
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 personaldetails (regID, firstname, lastname, sex, stateoforigin, email, telephone, username, password, useraccess) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['regID'], "int"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['lastname'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['stateoforigin'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['telephone'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['useraccess'], "text"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "property_details.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
property details
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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"] == "form2")) {
$insertSQL = sprintf("INSERT INTO propertydetails (propertyID, price, regID, cooNo, propType, intent, numofrooms, address, `state`, lga) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['propertyID'], "int"),
GetSQLValueString($_POST['price'], "int"),
GetSQLValueString($_POST['regID'], "text"),
GetSQLValueString($_POST['cooNo'], "text"),
GetSQLValueString($_POST['proptype'], "text"),
GetSQLValueString($_POST['intent'], "text"),
GetSQLValueString($_POST['numofrooms'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['lga'], "text"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "payment.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
payment
<?php require_once('Connections/estate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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"] == "form3")) {
$insertSQL = sprintf("INSERT INTO payment (paymentID, propertyID, cardType, `number`, securitycode, postcode, cardexp, email, regID) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['paymentID'], "int"),
GetSQLValueString($_POST['propertyID'], "int"),
GetSQLValueString($_POST['cardType'], "text"),
GetSQLValueString($_POST['number'], "int"),
GetSQLValueString($_POST['securitycode'], "int"),
GetSQLValueString($_POST['postcode'], "text"),
GetSQLValueString($_POST['cardexp'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['regID'], "int"));
mysql_select_db($database_estate1, $estate1);
$Result1 = mysql_query($insertSQL, $estate1) or die(mysql_error());
$insertGoTo = "logging.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
•
•
Join Date: May 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 1
Hi,I have seen your whole coding and i cant found little mistake in that.but may be its header transfer problem
try following code for header transfer in property details.php
$insertGoTo = "payment.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header("location:".$insertGoTo);
}
instead of header(sprintf("Location: %s", $insertGoTo));
I m not sure your problem will solve or not but may be it will help you.
best luck
try following code for header transfer in property details.php
$insertGoTo = "payment.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header("location:".$insertGoTo);
}
instead of header(sprintf("Location: %s", $insertGoTo));
I m not sure your problem will solve or not but may be it will help you.
best luck
•
•
Join Date: Jul 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 1
thanks Will try that.
Right not i started right from the beginning and been trying to request a primary field entry made in the first form so i can input its value in the second form as it is a foreign key in the second and third forms.
tried;
$query = "select regID from personal where email=$_POST[email]";
$result = msql_query($query) or die("this query failed");
while($row=msql_fetch_assoc($result))
{
$regID=$row["regID"];
}
but apparently it's not getting the primary key as the foreign key is not getting the same value as the primary key in other table, used auto increment for the primary key.
Thanks again
Right not i started right from the beginning and been trying to request a primary field entry made in the first form so i can input its value in the second form as it is a foreign key in the second and third forms.
tried;
$query = "select regID from personal where email=$_POST[email]";
$result = msql_query($query) or die("this query failed");
while($row=msql_fetch_assoc($result))
{
$regID=$row["regID"];
}
but apparently it's not getting the primary key as the foreign key is not getting the same value as the primary key in other table, used auto increment for the primary key.
Thanks again
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api blogger blogging blogs code code injection combo dani daniweb data debugging development dreamweaver dropdownlist epilepsy gdata google gpl griefers hackers html innovation javascript key linux microsoft module net news openbsd product programming reuse rss serial source tags vista web wysiwyg xml
- Previous Thread: Export to CVS with color
- Next Thread: get indian time in php


Linear Mode