Send visitors other page after selection

maybe the problem in the details.
So i have 3 files so far.:
form1.html
serc.php
vwaudidiesel.html
you can check them on the hcases.co.uk site.

What i want to do.
the main page is the form1.html there is 2 drop down option if someone choos vw and diesel then the visitor be directed to --> vwaudidiesel.html
and so on… so if someone choos fiat and petrol then be directed to —> fiatpetrol.html (fiatpetrol.html is not redy yet.

the problem at the moment:
when i do the if statment like this:

<?
$model = $_POST['model'];
$fuel = $_POST['fuel']; 

if( $model == 14 && $fuel==2 ) { 
   

	echo "this is vw diesel";
} 
	
else {
	echo "something else";
}
?>[/code]
it is works fine if someone choos vw and the diesel in the menu then printed the good text but when i ty to redirect to other page like this:

[code]<?
$model = $_POST['model'];
$fuel = $_POST['fuel']; 

if( $model == 14 && $fuel==2 ) { 
   
 header('Location: http://hcases.co.uk/vwaudidiesel.html');
 exit;
} 
	
else {
	echo "The if statement evaluated to false";
}
?>

It doesn’t work. , only an empty page be loaded.

Here are the codes i done so fare:
form1.html

[code]

Alfa RomeoBMWChryslerDaewooFiatFordHyundaiLand RoverMercedesMitsubishiNissanPorschePeugeot / CitroenRenaultRoverSaabSuzukiVW / Audi / Seat / SkodaVauxhallVolvo

Petrol Diesel

[/code]

serc.php

[code]<?
$model = $_POST[‘model’];
$fuel = $_POST[‘fuel’];

if( $model == 14 && $fuel==2 ) {

header(‘Location: http://hcases.co.uk/vwaudidiesel.html’);
exit;
}

else {
echo “The if statement evaluated to false”;
}
?>
[/code]

I dont post the vwaudidiesel.html it is to large. you can check it on the hcases.co.uk/vwaudidiesel.html
If you have any other idea how to do it it would be welcome.
Thanks for any help.

Try it this way.

[php]<?
$model = $_POST[‘model’];
$fuel = $_POST[‘fuel’];

if( $model == 14 && $fuel==2 ) {
header(‘Location: vwaudidiesel.html’);
}

else {
echo “The if statement evaluated to false”;
}
?>[/php]

unfortunetly no luck

Oh, Duh your if then statement is busted…

It should look like this.

[php]if( ($model == 14) && ($fuel==2) ) {
header(‘Location: vwaudidiesel.html’);
}

else {
echo “The if statement evaluated to false”;
}[/php]

Basically an if then statement must have a conclusion of true or false. your statement did not have the conditional statement set to a conclusion the difference being that yours resulted in and error where mine will result in something like ((true) and (true)) which equals (true). It could also result like ((True) and (False)) which equals False. Anyway because you were looking at the conjunction of two conditionals you needed to check the T/F values of the single conditionals before you could check the value of their combination…

thanx for your help.
unfortunetly it is still not working.
you can check on the hcases.co.uk/form1.html if you choose the vw/ audi / seat /skoda and diesel nothing happens just an empty page you get dont direct you to the vwaudi.html it is still stay on the serc.php

Post your code from serc.php

Did you remove the [size=10pt]exit;[/size] from the serc.php ?

[php]<?
$model = $_POST[‘model’];
$fuel = $_POST[‘fuel’];

if( ($model == 14) && ($fuel==2) ) {
header(‘Location: vwaudidiesel.html’);
}

else {
echo “The if statement evaluated to false”;
}
?>
[/php]

I am having no issues with your code.

Hard code the variables to true so $model = 14; and fuel = 2; if that works then you know the issue is not your if then statement and your header redirect.

If that does not work then the issue is your header statement or your if then statement

I got this to work as well.

[php]<?
$model = $_REQUEST[‘model’];
echo $model;
$fuel = $_REQUEST[‘fuel’];
echo $fuel;

if( ($model == 14) && ($fuel==2) ) {

header(‘Location: vwaudidiesel.html’);

echo “true”;
}

else {
echo “The if statement evaluated to false”;
}
?>

Alfa Romeo BMW Chrysler Daewoo Fiat Ford Hyundai Land Rover Mercedes Mitsubishi Nissan Porsche Peugeot / Citroen Renault Rover Saab Suzuki VW / Audi / Seat / Skoda Vauxhall Volvo

Petrol Diesel

[/php]

Ok, thanks for your time.

I think i just simply do a link for each page and forget this options form.

i think i tried lots of advise non working.
The hcase.co.uk/form1.html is working
the hcases.co.uk/vwaudidiesel.html is working
but they ar not working together with serc.php

So link for all pages will work i hope :slight_smile:
Thanks again.

Sponsor our Newsletter | Privacy Policy | Terms of Service