I have the trial3.php code here.

<html>
<head>
<title>
choose 1
</title>
</head>
<form>
<input type='radio' name='name1'>edit<?php echo "<form action=trial.php></form>";?></br>
<input type='radio' name='name2'>GMT<?php echo "<form action=trial2.php></form>"; ?></br>
<input type='submit' name='SEND' value='send'>
</form>
</html>

<?php
$send;
$fetch_DATA1=$_GET['name1'];
if($_GET['name1'])
echo "<form action=trial.php method=get></form>";
else
echo "<form action=trial2.php method=get></form>";
?>

what i want is to have 2 radio button selections that act as a switch case. for example I clicked on GMT then when I clicked on submit button... the GMT calculation page will run. and if it is not, then it shows the other one... if u cannot get the point of my problem... pls tell me

Recommended Answers

All 2 Replies

Each submit button belongs to a certain form tag. Your button belongs only to a parent <form> so while clicking nothing happens as the form has no action.

My suggestion would be to use a JavaScript and change the action link dynamically on the radio button check.

Sorry if I didn't get point of the problem...

yes javascript would be the best for this.
use:

document.getElementById("divtag").innerHTML="<form action=trial.php method=get></form>";

and just put <div id="divtag"></div> somewhere underneath and get rid of the original form action.

Obviously there is more javascript to go with it.
not really sure why you don't use if/else in your form handling script to merge all together. but not quite sure what you want to do.

hope this helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.