0

can i check is there anything wrong with my if else, if seems like it will only go banktransfer.php instead.

if ($_POST[Payment] = "Bank Transfer") {
	$btpage = "banktransfer.php";
		
		echo '<script language="javascript" type="text/javascript">window.location.href="'.$btpage.'";</script>';
		}
		else if ($_POST[Payment] = "Credit Card") {
			$ccpage = "creditcard.php";
		
		echo '<script language="javascript" type="text/javascript">window.location.href="'.$ccpage.'";</script>';
}

		else   {
			$pppage = "paypal.php";
		
		echo '<script language="javascript" type="text/javascript">window.location.href="'.$pppage.'";</script>';
}
3
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by almostbob
1

You're using = instead of ==

0

You're using = instead of ==

thanks. i tried using == , and all options will redirect to paypal.php instead

0

arrays are quoted if ($_POST['Payment'] many servers in the path between your server and the client do not handle spaces well, the $_post-ed value would be better as Bank_Transfer javascript redirects when using a server language ??
why send anything but the correct page to the client

<?php 
if($_POST['Payment'] == 'Bank_Transfer') {header("Location: banktransfer.php");
elseif($_POST['Payment'] == 'Credit_Card') {header("Location: creditcard.php");
else {header("Location: paypal.php");

or switch / case

edited '==' :(

Edited by almostbob: n/a

0

arrays are quoted if ($_POST['Payment'] many servers in the path between your server and the client do not handle spaces well, the $_post-ed value would be better as Bank_Transfer javascript redirects when using a server language ??
why send anything but the correct page to the client

<?php 
if($_POST['Payment'] == 'Bank_Transfer') {header("Location: banktransfer.php");
elseif($_POST['Payment'] == 'Credit_Card') {header("Location: creditcard.php");
else {header("Location: paypal.php");

or switch / case

edited '==' :(

still the same. i tried using credit_card and bank_transfer instead. all pointing to paypal.php

below is part of the form page

Payment Type:
  
<SELECT NAME="payment">
<OPTION VALUE="">Choose a Payment Type

<OPTION VALUE="Bank_Transfer">Bank Transfer</option>

<OPTION VALUE="Paypal">Paypal</option>

<OPTION VALUE="Credit_Card">Credit Card</option>





</SELECT>
1

in the form <select name='payment' in the handler if($_POST['Payment'] Case sensitive?? maybe; payment ≠ Payment ;
$_POST == "";//none of the checks return true, default 'else' result Paypal

change either the html form or the php handler, so they both use the same name

Edited by almostbob: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.