Jump to content

[SOLVED] Form action


Miko

Recommended Posts

Hello,

 

I have a search form where a user can insert 2 different values:

 

- track

- reference

 

depending with what kind of value the user want's to search this one is send to another website/link

 

- track -> for ex: www.track.com

- reference -> for ex: www.reference.com

 

The form has 2 radio buttons, so the user must chose one of both to get his result.

 

The action is not a problem, but it's how to know if the user has chosen track or reference.

 

I know that it should work with a if($track){go website}else{go other website}

But I don't know the whole technical part of this, anyone can help me out here?

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/160005-solved-form-action/
Share on other sites

I've tried this one, but I got this as error  :-\

 

 

Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\Test\google.php:1) in D:\xampp\htdocs\Test\google.php on line 11

 

my code:

 

<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" target="_blank">
Go Google:  <input type="text" name="bla"><input type="submit" name="go" value="GO">
</form>

<?php

$go = $_POST['go'];

if(isset($go)){

  	header('Location:http://www.hotmail.com');

}

?>

Link to comment
https://forums.phpfreaks.com/topic/160005-solved-form-action/#findComment-844053
Share on other sites

see if this helps:

 

<?php ob_start(); ?>


<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" target="_blank">
   Go Google:  <input type="text" name="bla"><input type="submit" name="go" value="GO">
</form>

<?php

   $go = $_POST['go'];

   if(isset($go)){

     header('Location:http://www.hotmail.com');

   }

?>

<?php ob_end_flush(); ?>

Link to comment
https://forums.phpfreaks.com/topic/160005-solved-form-action/#findComment-844060
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.