...

View Full Version : Multi page form...



oh_no!!!!!!!
10-11-2004, 10:30 AM
Hey guys,
I got a little problem with my new multi page form. It works fine and get my whole input data on the last page. But it doesnt work to send the data by mail to my account... Please gimme some aid :thumbsup:
Here is the whole source:::

fieldforwarder.php
<?php
function field_forwarder(){
global $_POST, $rEM979, $FFoutputType;
//get the arguments passed
$argList = func_get_args();

//globalize any other set of instructions
if(count($argList)){
eval('global $' . $argList[count($argList)-1] . ';');
}
//set the default set of values to convert
if(count($argList)==0){
//if the function is initially passed without parameter we're looking in $_POST
$argList[0] = '_POST';
$startValue = $_POST;
if(sizeof($startValue)==0){return false;}
}elseif(count($argList)==1){
eval( '$rEM979["' . $argList[0] . '"] = $' . $argList[0] . ';');
$argList[0] = 'rEM979';
$startValue = $rEM979;
}elseif(count($argList)==2){
eval( '$startValue = $' . $argList[1] . '["' . $argList[0] . '"];');
}else{
for($e=count($argList)-2;$e>=0;$e--){
$intersperse .= '["' . $argList[$e] . '"]';
}
eval( '$startValue = $' . $argList[count($argList)-1] . $intersperse . ';');
}

foreach($startValue as $n => $v){
if(is_array($v)){
//call the function again
$shiftArguments = '';
for($w=0;$w<=count($argList)-1;$w++){
$shiftArguments .= '"' . $argList[$w] . '", ';
}
$shiftArguments = substr($shiftArguments, 0, strlen($shiftArguments)-2);

eval('$fieldForwarder .= field_forwarder("' . $n . '"' . substr(',',0,strlen($shiftArguments)) . ' ' . $shiftArguments . ');');

}else{
//we have an root value finally
if(count($argList)==1){
//actual output
flush();
if($FFoutputType == 'print'){
$fieldForwarder .= "$$n = '$v';n";
}else{
$fieldForwarder .= "<input type=\"hidden\" name=\"$n\" value=\"" . htmlentities(stripslashes($v)) . "\">\n";
}
}elseif(count($argList)>1){
$indexString = '';
for($g=count($argList)-3;$g>=0;$g--){
$indexString .= '[' . ((!is_numeric($argList[$g]) and $FFoutputType=='print')?"'":'') .
$argList[$g] . ((!is_numeric($argList[$g]) and $FFoutputType=='print')?"'":'') . ']';
}
$indexString .= '[' . ((!is_numeric($n) and $FFoutputType=='print')?"'":'') .
$n . ((!is_numeric($n) and $FFoutputType=='print')?"'":'') . ']';
//actual output
flush();
if($FFoutputType == 'print'){
$fieldForwarder .= "${$argList[count($argList)-2]}$indexString = '$v';n";
}else{
$fieldForwarder .= "<input type=\"hidden\" name=\"{$argList[count($argList)-2]}$indexString\" value=\"" . htmlentities(stripslashes($v)) . "\">n";
}
}
}
}
return $fieldForwarder;
}//end field_forwarder()
?>

final.php:
<?php
include ('fieldforwarder.php');
?>
<HTML>
<HEAD>
<TITLE>Multi-page Form - Final</TITLE>
</HEAD>
<BODY>
<p>You filled in:</p>
<FORM METHOD="POST" ACTION="send.php">
Name: <?php echo $_POST['cust_name']; ?><BR>
Email: <?php echo $_POST['cust_email']; ?><BR>
Address: <?php echo $_POST['cust_address']; ?><BR>
Phone: <?php echo $_POST['cust_phone']; ?><BR>
<INPUT TYPE="submit" name="submit2" value="Proceed">
</FORM>
</BODY>
</HTML>

form1.php:

<HTML>
<HEAD>
<TITLE>Multi-page Form - Page One</TITLE>
</HEAD>
<BODY>
<p>Please fill in the following information</p>
<FORM METHOD="POST" ACTION="form2.php">
Name: <INPUT TYPE="text" SIZE="40" name="cust_name"><BR>
Email: <INPUT TYPE="text" SIZE="40" name="cust_email"><BR>
<INPUT TYPE="submit" name="submit1" value="Proceed">
</FORM>
</BODY>
</HTML>

form2.php

<?php
include ('fieldforwarder.php');
?>
<HTML>
<HEAD>
<TITLE>Multi-page Form - Page Two</TITLE>
</HEAD>
<BODY>
<p>Please fill in the following information</p>
<FORM METHOD="POST" ACTION="final.php">
Adress: <INPUT TYPE="text" SIZE="50" name="cust_address"><BR>
Telefon: <INPUT TYPE="text" SIZE="20" name="cust_phone"><BR>
<?php echo field_forwarder(); ?>
<INPUT TYPE="submit" name="submit2" value="Proceed">
</FORM>
</BODY>
</HTML>

Nightfire
10-11-2004, 03:15 PM
Well it won't send anything by email without using the mail() function, which I don't see anywhere in there

oh_no!!!!!!!
10-11-2004, 04:10 PM
ok. :-) this is the file the whole thread is about... where*s my brain?


send.php

<title>FORM</title>
<?php
include ('fieldforwarder.php');
if ($cust_name=="" || $cust_email=="" || $cust_address=="" || $cust_phone=="" || $cust_county=="" || $cust_land=="") { echo "Please check your input data!";
exit;}
$recipient = "myemail@world.com";
$about = "form";
$message = "" ;
mail($recipient, $about, $message, "FROM: multi page form");
?> :rolleyes: :rolleyes: :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum