Jump to content

Archived

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

pstanbra

help im stuck on passing vars from form to php and back

Recommended Posts

Hey - If sum1 cud help me u will ease my headache.
I have a html  posting to php outlined below. However based on form input, php will redirect to a paymeent page. However I want to take all the variables from the previous form onto the payment gateway form...




here is my php file:

$Message = "";
    if (!is_array($HTTP_POST_VARS))
    return;
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$Message .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$Message .= "$vala, ";
}
$Message .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $Message .= "$key: - <br>"; }
else { $Message .= "<b>$key:</b> $val<br>"; }
}
}
} // end while
$Message = "<font face=verdana size=2>".$Message;
mail( $MailToAddress, $MailSubject, $Message, "Content-Type: text/html; charset=ISO-8859-1\r\nFrom: ".$email."\r\nBCc: ".$MailToCC);


if(isset($_POST['service'])){
     switch($_POST['service']){
          default:
               header("Location:http://www.google.co.uk");
               break;
          case 'PC Health Check':
               header("Location:http://www.sysfix.co.uk/pay.html");
               break;
          case 'Technical Support':
               header("Location:http://www.yahoo.co.uk");
               break;
     }
}
?>

so i basically get emaild a form to email - then a redirect to a payment url -
FYI - the form tags relate to the tags expected by the form on the gayeway page.

I hope u understand what im trying to address...





Share this post


Link to post
Share on other sites
eg - i need this header("Location:http://www.sysfix.co.uk/pay.html");
to be like

header("Location:http://www.sysfix.co.uk/pay.html"[b] ?var1&var2"[/b]

Share this post


Link to post
Share on other sites
[code]

<?php

header("Location: http://www.sysfix.co.uk/pay.php?var=$var&var2=$var2");
exit();

?>

[/code]

Share this post


Link to post
Share on other sites
hi - I didnt realise it was that easy.. Well, it's kinda what i'm looking for;

so my form sends the variable to a php file which is a form to email script. I then set a redirect based on a form dropdown and have changed the link so it passes the variables on like you said as below ..

header("Location:http://www.sysfix.co.uk/pay.html?firstname=$firstname"

However the redirect to pay.html also has a form. I've set up all form elements with the same variable names and have marked the elements as hidden so all that remains is a pay now button. How do these variables get passed on??

I tried changing my form element to
<input name="firstname" type="hidden" id=$firstname> however all i get in the payment field on my card processor is $firstname  arghhh

any ideas?
 

Share this post


Link to post
Share on other sites

×

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.