Jump to content

Archived

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

ltoto

If Statements around Forms, help needed

Recommended Posts

Basically what I have got so far is an Initial Enquiry Form. And on this enquiry form there is a drop down list where you can select either 'hotel', 'villa' or ' golf', along with other information.
When this is selected it goes to another page with the the form that has been selected on 'hotels', 'Villas' and 'golf'. ( hope this is making sense so far.

This is the code used to do this.

[code]header("Location:index.php?Id=18&type=".$_POST['selectType']);[/code]

so i have three forms on one page, but if that form is not selected, i do not want to to show up on the pagee.g

if hotel is selected in the dropdown menu from the initial enquiry form, i would not want the villa or golf form to appear.

so what i want to know is what i have to put around each of the forms so they only show up if selected, , i would guess something like:

so if the site = " golf " show the gold form on index?Id=18


obviously with out the english


any suggestions?

Share this post


Link to post
Share on other sites
it would be easier to use javascript (google it) but you can do it in php a much longer way. (could google this too).

<?php

// LETS CALL YOUR DROP DOWN 'place' //
// SO IT'D BE SOMETHING LIKE THIS //
$page = $_POST['page']

if($page == 'hotel'){

  // SHOW THIS FORM //

} else if($page == 'villa'){

  // SHOW THIS FORM //

} else if($page == 'golf'){

  // SHOW THIS FORM //

} else {

  // DEFAULT FORM //

}

?>

something like that should work

Share this post


Link to post
Share on other sites
i cant connect to the ftp tonight, so i will give this a go tommorrow and let you know how i get on, thanks for the advice

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.