Forum Moderators: open

Message Too Old, No Replies

Radio buttons - sending to server when they're clicked

         

Madhu

4:57 am on Sep 12, 2007 (gmt 0)

10+ Year Member



Hai friends

i have five radio buttons...what i want is ,if i click any one of the radio button its value shuld go to the database.

thanks,
Madhu

deMorte

12:39 pm on Sep 12, 2007 (gmt 0)

10+ Year Member



Hello.

You can probably achieve this with JavaScript.

I'm no hotshot with JavaScript but this is from another forum I found:


<form method="post">
<input type="radio" id="r_action" name="r_action" value="r_action" onClick="this.form.action='your_script.php';this.form.submit()">
</form>

(I'm not sure if I can link to the forum)

In your_script.php file you collect the data from post variable and send it to the database.

BlobFisk

4:36 pm on Sep 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Madhu,

This sounds like a perfect place to use Ajax. This allows you to communicate asynchronously with the backend of your system with out using a whole page HTTP POST.

There's loads of online literature about this and our Javascript forum is a great place to ask questions.

HTH