Jump to content

need help forms


sethupathy

Recommended Posts

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

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

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

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.