sethupathy Posted June 11, 2007 Share Posted June 11, 2007 i have two forms for diffrent type of company in step 1 they have to sectlect company 1 (form1) or company 2 (form2) depending on what they choose i will redirect them to the proper form, how do i put this into a script, Thanks Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/ Share on other sites More sharing options...
smc Posted June 11, 2007 Share Posted June 11, 2007 Well its Javascript if you want them to do a drop down menu and when they select it have them redirect. PHP would be this: First of all you would want Company 1 and Company 2 to be in the same form. Lets say the form's "name" is myform, Company 1's value is "1" and Company 2's "2" You would then have the forum submit to the PHP script, in the PHP script you would have something like: $choice = $_POST['myform']; //Use addslashes( ); around the $_POST var to increase security if( $choice == "1" ){ header( 'location: /company1.html' ); exit; } if( $choice == "2" ){ header( 'location: /company2.html' ); exit; } The header() function is touchy, but basically re-directs the user. Hope this helps Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272462 Share on other sites More sharing options...
Jaguar Posted June 11, 2007 Share Posted June 11, 2007 Would you still need to addslashes for security even though it is used purely for a comparison? Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272470 Share on other sites More sharing options...
smc Posted June 11, 2007 Share Posted June 11, 2007 To be totally honest with you I don't know. These guys are constantly figuring out new ways to abuse PHP, but when I program I always like to think the person hacking me is smarter than I am so I always use percaussions no matter what. It affects parse time by mere miliseconds (if at all) so why not Edit: Technically speaking if they knew enough about your code they could. If you have DB connection on the page, for example, they might be able to break the variable into a mysql_query and do some malicious stuff. Never underestimate teenage-bordeom Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272472 Share on other sites More sharing options...
sethupathy Posted June 11, 2007 Author Share Posted June 11, 2007 right now i have to separate forms, how do i go about making one form out of them ? any tutorials on this? Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272500 Share on other sites More sharing options...
smc Posted June 11, 2007 Share Posted June 11, 2007 Well no what I mean is on the page that originally asks which company they want it is in something like this: <form action = "<?php $_SERVER['PHP_SELF'] ?>" method = "post"> <p><select size="1" name="myform"> <option value="1">Company 1</option> <option value="2">Company 2</option> </select><input type="submit" value="Submit" name="submit"></p> </form> The actual forms you want to redirect to do not have to be seperated or combined, you can leave them on their respective pages. Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272505 Share on other sites More sharing options...
sethupathy Posted June 11, 2007 Author Share Posted June 11, 2007 Another problem Solved Thanks a bunch dude i am starting to get this bit by bit. Link to comment https://forums.phpfreaks.com/topic/55112-need-help-forms/#findComment-272515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.