Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
passing a value from a radio button
Old 03-01-2009, 03:23 PM passing a value from a radio button
Average Talker

Posts: 21
Name: Hal
Trades: 0
I'm trying to pass a value from a radio button choice - on the same page.

Here is my code for getting user input:

<div id="pnlSpeaks">
<span><input type="radio" name="speaks" value="Y" /></span>
<span><input type="radio" name="speaks" value="N" /></span>
<span><input type="radio" name="speaks" value="" checked/></span>

</div>

And here is the code to get info from submitted input:

$FilterSpeaks = $_POST['speaks'];

Here, I add these values as conditions to a mysql query:


if (isset($_POST['submit']))
{ $FilterSpeaksQuery = " AND speaks = '" . $FilterSpeaks . "'";
$FilterSet = TRUE; }

Since the mysql query didn't work, I tried just printing $FilterSpeaksQuery.
And here is where I think it should print, but it doesn't:


print "$FilterSpeaksQuery";

Appreciate any help.
hoco is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-01-2009, 04:50 PM Re: passing a value from a radio button
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
From the code you gave me, I would assume that the if(isset($_POST['submit'])) is not working the way you intend because $FilterSpeaksQuery is empty.

Can you post more of your code?
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-02-2009, 02:44 PM Re: passing a value from a radio button
Average Talker

Posts: 21
Name: Hal
Trades: 0
rogem002 -

You're right, if(isset($_POST['submit'])) wasn't working causing $FilterSpeaksQuery to be empty.

I replaced
if (isset($_POST['submit']))
with
if (!empty($FilterSpeaks))

$FilterSpeaksQuery is now getting its value.

Problem Solved !!
hoco is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to passing a value from a radio button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12206 seconds with 12 queries