Jump to content

Archived

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

ltoto

Linking Forms

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
or
on first form
<input type='hidden' name='id_num' value='".$id_num."' />

on the second form,
<input type='hidden' name='id_num' value='".$_POST["id_num"]."' />

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.