Reputation: 161
I want to link when the user choose one of the radio button below to one of the php files, also I put a button and this button doesn't appear I don't know why :
<html>
<body>
<form action="">
<h4><b>Please choose one of the following options below : </b> </h4>
<input type="radio" name="option" value="search" /> Search <br/>
<input type="radio" name="option" value="open database" /> Open Database<br/>
<input type="radio" name="option" value="administrative page "/> Administrative Page <br/>
</form>
// This button doesn't appear in the web page =( .. dunno why
<form action="">
<input type="button" value="Choose ">
</form>
</body>
</html>
Upvotes: 0
Views: 6032
Reputation: 1284
You should make your code like this
<html>
<body>
<form action="">
<h4><b>Please choose one of the following options below : </b> </h4>
<input type="radio" name="option" value="search" /> Search <br/>
<input type="radio" name="option" value="open database" /> Open Database<br/>
<input type="radio" name="option" value="administrative page "/> Administrative Page <br/>
<input type="submit" value="Choose ">
</form>
</body>
</html>
Note that the button is in the same <form>
tag as the radio options and that it is a submit
input type instead of a button
You can see the result here: http://jsfiddle.net/Sv6q2/
Here an example without button, but with onclick event on the radio's (note you don't need a <form>
tag anymore):
<html>
<body>
<h4><b>Please choose one of the following options below : </b> </h4>
<input type="radio" name="option" value="search" onclick="document.location.href='search.php'"/> Search <br/>
<input type="radio" name="option" value="open database" onclick="document.location.href='database.php'" /> Open Database<br/>
<input type="radio" name="option" value="administrative page " onclick="document.location.href='admin.php'"/> Administrative Page <br/>
</body>
</html>
And the result you can find here: http://jsfiddle.net/Sv6q2/2/
Upvotes: 1
Reputation:
You should use jquery. Without it it's hard.
First write a little function that handles click operation, than call your function via
onChance="myFunction(this);"
Also add a custom attribute to your radio buttons that includes you php file names you want to go.
Upvotes: 0