home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

PHP Radio Button Email Help, Verify Password

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2087
Discussions: 200,919, Posts: 2,379,049, Members: 246,287
Old June 25th, 2003, 10:41 PM   Digg it!   #1 (permalink)
Ultimate Member
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,385
Send a message via AIM to embj Send a message via MSN to embj Send a message via Yahoo to embj
PHP Radio Button Email Help, Verify Password

I am new to PHP and have just coded my first form handler. I got everything to work just fine except when trying to get the radio button choices to come to my email box.

Here is what I have for my form radio buttons:

Do you want a phpBB board?<br>
<input name="phpBByes" type="radio" id="phpBByes" value="<? echo $phpBByes; ?>">Yes
<input name="phpBBno" type="radio" id="phpBBno" value="<? echo $phpBBno; ?>">No
<br><br>

I've got it carrying these variables in the email script:
phpBB: $phpBByes $phpBBno

It will just display nothing in its place. How can I get it to show up?

Also, I would like to know how to make it so you have the verify password box like if your passwords don't match it will tell you.

Thanks!
embj is offline   Reply With Quote
Old July 7th, 2003, 10:51 PM     #2 (permalink)
Ultimate Member
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Arizona
Posts: 2,538
You must use the same "name" for radio buttons. Choose something like phpBBask.

PHP Code:
if($userpassword != $userpassword2) {
echo 
"Your desired password and retyped password do not match"
}; 
Someone may have a better way, but that's what comes to my mind.
Praetorian is offline   Reply With Quote
Old July 8th, 2003, 12:24 AM     #3 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
You must use the same "name" for radio buttons.

radio buttons are exclusive, can only choose one. In PHP, will return value of radio button selected.

If you want the user to have more choices, use checkbox.

for PHP:

<input type=checkbox name=choices[]...

in PHP, you now have array of choices...
qball is offline   Reply With Quote
Old July 8th, 2003, 03:46 AM     #4 (permalink)
Ultimate Member
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Arizona
Posts: 2,538
Well it's a yes or no question. In order to return the correct value for the selection, the radio button has the have the same "name", but values can be different (they have to be).
Praetorian is offline   Reply With Quote
Old July 8th, 2003, 09:08 AM     #5 (permalink)
Ultimate Member
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,385
Send a message via AIM to embj Send a message via MSN to embj Send a message via Yahoo to embj
Well, I have the form so it has this on it:

PHP Code:
<input name="phpBB" type="radio" id="phpBB" value="<? echo $phpBByes?>">Yes
<input name="phpBB" type="radio" id="phpBB" value="<? echo $phpBBno?>">No
Then in the processor I have it posting:
PHP Code:
$phpBB $_POST['phpBB']; 
Then:
PHP Code:
$phpBB stripslashes($phpBB); 
Then:

PHP Code:
if((!$phpBB)){ 
Then:

PHP Code:
if(!$phpBB){
        echo 
"Whether you want phpBB or not this is required. Please select yes or no below.<br />";
    } 
Then I include the form. Then I exit.

Lastly I have my email form and it shows the variable of this: $phpBB

How would I get the password validation thing if I already use that method to check for fields not being filled out?

Thanks for the responses.
embj is offline   Reply With Quote
Old July 9th, 2003, 01:34 AM     #6 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
In order to return the correct value for the selection, the radio button has the have the same "name", but values can be different (they have to be).

can be, or have to be?

Depending on version of PHP, I think (can try later...):

In PHP, will return value of radio button selected.

anyway, what are the values of $phpBByes and $phpBBno when form is created. Then, regardless of either choice, what is returned from form input?
qball is offline   Reply With Quote
Old July 10th, 2003, 03:09 AM     #7 (permalink)
Ultimate Member
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,385
Send a message via AIM to embj Send a message via MSN to embj Send a message via Yahoo to embj
Say what?
embj is offline   Reply With Quote
Old July 10th, 2003, 03:41 AM     #8 (permalink)
Ultimate Member
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Arizona
Posts: 2,538
He means the values have to be different. It's pointless sending the same value across for both choices.
Praetorian is offline   Reply With Quote
Old July 10th, 2003, 03:54 AM     #9 (permalink)
Ultimate Member
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,385
Send a message via AIM to embj Send a message via MSN to embj Send a message via Yahoo to embj
The values are $phpBByes & $phpBBno. And from what that looks like to me...it is different.
embj is offline   Reply With Quote
Old July 10th, 2003, 11:03 PM     #10 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
The values are $phpBByes & $phpBBno.

No. The variables are named $phpBByes & $phpBBno. The values of the variables is what actually gets placed into the HTML form. So determine what the values are placed in the form during script execution. Easy way, run the PHP script in browser, do a view source. Better way, debug the PHP script, as in.

print "BByes= ". $phpBByes;
print "BBno= ". $phpBBno;
//then code for HTML form

Then in handler:

print "form post val = ". $_POST['phpBB'];
.....

Wonder if:

if((!$phpBB)){

is even applicable, as return should be string (value attribute of form element), not boolean???

Don't have my PHP code handy, else, could tell you...

Last edited by qball : July 10th, 2003 at 11:05 PM.
qball is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2847)
Obama the Muslim (12)
Why is Khalid Sheikh Mohammed even .. (9)
Is the PSU I received dead? (10)
windows vista security holes (7)
Foreign voltage (10)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (9)
A good PSU? (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Print spooler problem (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Help getting around port 80 for camer.. (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (31)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
windows vista security holes (7)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
monitor will not turn on at all, (0)
Modern Warfare 2: Who Bought It? (61)
World's largest Monopoly Game using G.. (330)
Print spooler problem (10)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
Display shows 3x5 inch in middle of s.. (0)
HIS HD5770 graphic card question (15)
Best file format to play on Windows H.. (0)
PSP Go bought in Japan (0)
Asus P4G8X Mobo (3)
Need hard disk drivers (4)
windows 7 internet problem (4)


All times are GMT -4. The time now is 06:51 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28