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>';
}
Member Avatar for diafol

You're using = instead of ==

You're using = instead of ==

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

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 '==' :(

Member Avatar for diafol

Still single equals :)

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>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.