Jump to content


Photo

If Statements around Forms, help needed


  • Please log in to reply
2 replies to this topic

#1 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 20 September 2006 - 04:21 PM

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.

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

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?

#2 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 20 September 2006 - 04:39 PM

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

#3 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 20 September 2006 - 09:10 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users