Jump to content

Linking Forms


ltoto

Recommended Posts

Ok, so what i need to do is link 2 forms together with Id, i have done something like it before, but not this way.... and Im now just confused.

So firstly what i have is an initial enquiry form. where they can select personal details, for a holiday, and they can select a type, which is either Hotel, Villa or Gold, and when they sumbit this form it goes to a larger form depending on what type they have selected, so if the select golf as the type on the first one, it will go to the golf form when sumbimitted.

Now through both of these forms, i need to have the same reference number through both, which i am using the id from the first form for this.

So basically how do i do this
Link to comment
https://forums.phpfreaks.com/topic/22253-linking-forms/
Share on other sites

When the first form is submitted, you place the id into a session variable...

[code]
<?php
sesion_start();
$_SESSION['id'] = $_GET['id'];
?>
[/code]

Then you create your if statement...

[code]
<?php
if ($_GET['type'] == "Hotel"){
  header("Location: hotel.php");
}
else if ($_GET['type'] == "Villa"){
  header("Location: villa.php");
}
else if ($_GET['type'] == "Golf"){
  header("Location: golf.php");
}
?>
[/code]

Then your golf.php looks something a little like this:

[code]
<?php
session_start()
echo <<<HTML
<input type="hidden" name="id" value="{$_SESSION['id']}">
<input type="text" name="details">
HTML;
?>
[/code]

Regards
Huggie
Link to comment
https://forums.phpfreaks.com/topic/22253-linking-forms/#findComment-99668
Share on other sites

Archived

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

×
×
  • 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.