ltoto Posted September 27, 2006 Share Posted September 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/22253-linking-forms/ Share on other sites More sharing options...
HuggieBear Posted September 27, 2006 Share Posted September 27, 2006 When the first form is submitted, you place the id into a session variable...[code]<?phpsesion_start();$_SESSION['id'] = $_GET['id'];?>[/code]Then you create your if statement...[code]<?phpif ($_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]<?phpsession_start()echo <<<HTML<input type="hidden" name="id" value="{$_SESSION['id']}"><input type="text" name="details">HTML;?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/22253-linking-forms/#findComment-99668 Share on other sites More sharing options...
onlyican Posted September 27, 2006 Share Posted September 27, 2006 oron 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"]."' /> Quote Link to comment https://forums.phpfreaks.com/topic/22253-linking-forms/#findComment-99712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.