Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.