User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,898 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 1,932 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: 528 | Replies: 2
Reply
Join Date: Jul 2007
Posts: 9
Reputation: ibrahimssani is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
ibrahimssani ibrahimssani is offline Offline
Newbie Poster

dreamweaver $insertGoTo generated code

  #1  
Jun 29th, 2008
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));
}
?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2008
Posts: 13
Reputation: phpuser is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
phpuser phpuser is offline Offline
Newbie Poster

Re: dreamweaver $insertGoTo generated code

  #2  
Jul 1st, 2008
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
Reply With Quote  
Join Date: Jul 2007
Posts: 9
Reputation: ibrahimssani is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
ibrahimssani ibrahimssani is offline Offline
Newbie Poster

Re: dreamweaver $insertGoTo generated code

  #3  
Jul 1st, 2008
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:35 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC