Jump to content

If Statements around Forms, help needed


ltoto

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?
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.