Jump to content

How do I get information from an order page to:


dsloan

Recommended Posts

How do I get information from and html order form to a Php Form developed that will take the submitted information and transfer it to the confirmation page. Only the information that was selected will be transferred. No hiding information will be allowed. Therefore the information that was selected from the order form will transfer to the confirmation page and it has been verified then the remaining information will be submitted for completion of order. I have and order form already with the php form for processing the order and responding with an email. But my problem is that the order for is very large and the client wants just what is ordered not 0's in the non ordered spaces. This is my delimea and I am a noob.  So if anyone can help me please do.

This is a demo for what am I doing.

<?php

// Receiving variables

@$pfw_ip= $_SERVER['REMOTE_ADDR'];

@$company = addslashes($_POST['company']);

@$customerCode = addslashes($_POST['customerCode']);

@$address = addslashes($_POST['address']);

@$phone = addslashes($_POST['phone']);

@$suiteno = addslashes($_POST['suiteno']);

@$orderedby = addslashes($_POST['orderedby']);

@$city = addslashes($_POST['city']);

@$states = addslashes($_POST['states']);

@$zipcode = addslashes($_POST['zipcode']);

@$item001 = addslashes($_POST['item001']);

@$item002 = addslashes($_POST['item002']);

@$item003 = addslashes($_POST['item003']);

@$item004 = addslashes($_POST['item004']);

@$item005 = addslashes($_POST['item005']);

 

// Validation

//Sending Email to form owner

$pfw_header = "From: $customerCode\n"

  . "Reply-To: $customerCode\n";

$pfw_subject = "test subject";

$pfw_email_to = "[email protected]";

$pfw_message = "Visitor's IP: $pfw_ip\n"

. "company: $company "

. "customerCode: $customerCode "

. "orderedby: $orderedby\n"

. "address: $address "

. "suiteno: $suiteno "

. "phone: $phone\n"

. "city: $city "

. "states: $states "

. "zipcode: $zipcode\n"

. "item001: $item001 "

. "item002: $item002 "

. "item003: $item003 "

. "item004: $item004 "

. "item005: $item005 "

@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 

 

?>

 

 

This is a demo for the test code that I'm using. How do I  get only the information that is chosing from the initial orderform which is Html to the confirmation page. That would show only what is ordered. Or is there a java script validation that will cancel out 0's in the html part of the form.

just FYI. the addslashes isn't enough to clean up data. Here's a simple function to get you started on easily cleaning up input:

<?php
/**
* cleanInput: Takes either a single-dimension array or a variable, and cleans it up
* making it safe for your database.
*
* @param array/variable $input
* @return array/variable
*/
function cleanInput($input){
/* ************************************************************************ */
/* Either fill out the following, or include a file that established the db */
/* connection.                                                              */
/* ************************************************************************ */
$db_host = "localhost";
$db_user = "***********";
$db_pass = "***********";
$db_db = "your_db";
$link = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_db, $link);
/* END Edit */
if (is_array($input)){
	foreach ($input as $key=>$value){
		$tmp = mysql_real_escape_string(html_entity_decode($value));
		$output[$key] = addslashes($tmp);
	}
}
else {
	$tmp = mysql_real_escape_string(html_entity_decode($value));
	$output = addslashes($tmp);
}
if ($link){
	mysql_close($link);
}
return $output;
}
?>

Now, it could be made to do more, but this is an older script of mine. I use some variant of it in all my code. I'd recommend you do something similar.

I see no reason to clean it up I'm not accessing any sql dbase. What I'm trying to do is extract information from an HTML form and am wanting only that which is ordered instead of the 0's that also accompany the orderform. The 0's are there due to a validation check format I'm using. So that's where I'm lost.

I don't have an array built up just what is extracted after the confirmation page. If you want to see what i'm talking about this is what I'm working on. http://www.healthwisenri.com/orderform.htm  this is in no way promotion for them but so you can get an understanding of what I'm working with.

I think this will solve your problem (if I understand the issue properly):

<?php
// Receiving variables
$items = "";
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$company = addslashes($_POST['company']);
@$customerCode = addslashes($_POST['customerCode']);
@$address = addslashes($_POST['address']);
@$phone = addslashes($_POST['phone']);
@$suiteno = addslashes($_POST['suiteno']);
@$orderedby = addslashes($_POST['orderedby']);
@$city = addslashes($_POST['city']);
@$states = addslashes($_POST['states']);
@$zipcode = addslashes($_POST['zipcode']);
foreach ($_POST as $key=>$value){
if ($value == '0' || empty($value)){
	unset($_POST[$key]);
}
if (key_exists($key, $_POST) && strstr($key, "item")){
	$value = addslashes($value);
	$items .= "$key: $value \n";
}
}
// Validation
//Sending Email to form owner
$pfw_header = "From: $customerCode\n"
  . "Reply-To: $customerCode\n";
$pfw_subject = "test subject";
$pfw_email_to = "[email protected]";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "company: $company "
. "customerCode: $customerCode "
. "orderedby: $orderedby\n"
. "address: $address "
. "suiteno: $suiteno "
. "phone: $phone\n"
. "city: $city "
. "states: $states "
. "zipcode: $zipcode\n"
. "$items";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;


?>

Archived

This topic is now archived and is closed to further replies.

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