...

View Full Version : form help please



bufhal
06-14-2006, 01:37 PM
Hello, I hope someone can help point me in the right direction.
I am building a multi page form. The first page has three options(below). What I need is for the user, upon clicking the "Next Page" button be directed to either a supportscsi.php page, supportfibre.php page or a supportiscsi.php page, depending on what technology option they have chosen. I am unclear on what PHP code to put in the beginning of the form for form metod and post, the three options and the "Next Page" name section.
<FORM METHOD=POST ACTION="/techsupt2.php" NAME="register">

<select name="Technology">
<option value>-----Please select-----</option>
<option value="Fibre">Fibre Channel</option>
<option value="SCSI">SCSI</option>
<option value="iSCSI">iSCSI</option>
</select>

<input type="submit" value="Next Page" name="" />

I appreciate any help. Thank you in advance.

MRMAN
06-14-2006, 04:51 PM
i would do this.


<?
$pagename = $_POST["Technology"];
switch($pagename)
{
case "Fibre": $pagename = "supportfibre.php"; break;
case "SCSI": $pagename = "supportscsi.php"; break;
case "iSCSI": $pagename = "supportiscsi.php"; break;
default; print "PAGE NO FOUND";
}

header ("location: $pagename");
?>

Reason i have put it in a switch statement and not just done this



$page = "support".$_POST["Technology"] .".php";


is that it makes sure they can only go to those three pages.
i.e. if you have a page called supportbras.php or supportthekippers.php
people could make the form go to those two.

bufhal
06-15-2006, 01:07 PM
Thanks. I tried your code and when I try to open the form in Dreamweaver, it is redirected to the homepage to our site...
Any ideas?

bufhal
06-15-2006, 02:08 PM
Here is what I have for the beginning of the form:

<FORM METHOD=POST ACTION="" NAME="register">

here is what I have for the submit to the next page at the bottom of the form:

<input type="submit" value="Next Page" name="Technology" />

I appreciate your time/help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum