Jump to content

Form submit


Miko

Recommended Posts

Hello,

 

I have a form with 2 radio buttons.

Depending of the selected radio button my php script goes to a different site.

The script isn't a problem, this one works how it should be.

 

But when enter a value and hit enter the page refreshes and when I click on Track!, it actually goes to the website.  ???

 

my code:

 

<div class="track">

	<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" class="track_form" target="_blank">
		<input type="radio" name="radio1" value="Parcelnumber" checked><label for="parcel">Parcelnumber</label>
		<input type="radio" name="radio1" value="Referencenumber"><label for="reference">Referencenumber</label>
			<br />
		<input type="text" name="searchvalue" class="track_search" size="29">
		<input type="submit"  name="track" value="Track!" class="track_bttn">
	</form>

</div><!-- track -->

<?php

$track_bttn = $_POST['track'];
$radio1 = $_POST['radio1'];
$searchvalue = $_POST['searchvalue'];
$username = "******";
$password = "******";
$lang = "en";

if(isset($track_bttn) && isset($radio1)){
	if($radio1 == 'Parcelnumber'){
		header("Location:xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
	}
	if($radio1 == 'Referencenumber'){
		header("Location:*************************");
	}
}

?>

 

 

Anyone an idea?

Link to comment
https://forums.phpfreaks.com/topic/160763-form-submit/
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.