JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2012, 03:33 PM
Peter5364 Peter5364 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 Peter5364 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 38 sec
Reputation Power: 0
Form Validation (Radio Buttons...)

Hi Guys,

I have created a very simple form with a text box and radio buttons. I am using javascript to echo my php in a div but it won't allow me to see which radio button was selected! Nightmare... :-(

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head>  <body>  <form id="testForm" method="post" >  <input type="text" name="info" >info<br> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female  <input type="submit" value="Submit"> </form>   <div id="response"> dafadf          	<div class="clearer"></div><!--clearer-->                       </div><!--response-->   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/testForm.js"></script>   </body> </html>


Code:
 testForm.js file  $(document).ready(function() { 	$("#testForm").submit(function() 	{ 		 		var sex_Js = $("#sex").val(); 		 		var info_Js = $("#info").val(); 	 		 		$("#response").load("../testPhp.php",{ 		 		sex:sex_Js, 		 		info:info_Js 	 		}); 		 	return false; 	}); 	 });


PHP Code:
<?php       $nameField_PHP $_POST['sex'];           $info_PHP $_POST['info'];               echo $info_PHP;         echo "<br />" $nameField_PHP;           ?>


Why isn't the javascript sending the radio buttons value through to the PHP?

Many thanks.

Reply With Quote
  #2  
Old October 2nd, 2012, 01:13 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 605 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 16 h 30 m 44 sec
Reputation Power: 69
This link might be helpful to you:http://api.jquery.com/jQuery.post/.

Reply With Quote
  #3  
Old October 2nd, 2012, 06:25 PM
Peter5364 Peter5364 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 Peter5364 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 38 sec
Reputation Power: 0
Thank you for your help!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Form Validation (Radio Buttons...)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap