You could do it server-side or client-side, I guess.
For server side you make sure that the radio buttons' value is submitted to the server and then check which was selected there (like
something.html:
<form method="POST" action="handle.php">
<!-- your form here -->
</form>
handle.php:
if ($_POST["radiobuttongroupname"] == "something")
header("Location: index.php");
else
header("Location: another.php");
).
Or for client side you use the onsubmit event of the form to check which was selected (something like
<script>
function handleSubmit(form) {
if (form.radiobuttongroupname.value == "something")
form.action = "index.php";
else
form.action = "another.php";
}
</script>
<form method="POST" onsubmit="handleSubmit(this)">
<!-- your form -->
</form>
)
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
when i am submitting a form with already checked radio button then this is inserting values in database but when i do checked another radio button then this will not insert value in database.
Ehh, I have no idea what you are trying to say...
Is it that one page does something that the other doesn't, but both really should (you could move this part to the handle.php)Second problem is that this is giving error header already sent when i am using header("Location:index.php") statement.
the header() function is one that seems to cause a lot of confusion for a lot of people. You can only use it before any other headers have been sent (headers are sent as soon as an echo or print or any other output statement is executed)
If these tips don't help at all then I don't think I can help much more without at least your error messages or some code that produces the error...
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
Hehe, well if it works it works right ;)
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13