home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Reply

PHP Radio Button Email Help, Verify Password

 
Thread Tools Search this Thread
Currently Active Users: 2309
Discussions: 207,853, Posts: 2,459,458, Members: 253,353
Get bargains at  »  Dealighted.com
Old June 25th, 2003, 09: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, 09: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 7th, 2003, 11:24 PM     #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, 02: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, 08: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, 12: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, 02: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, 02: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, 02: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, 10: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 10:05 PM.
qball is offline   Reply With Quote
Ask a Tech Question (free)!
Most Active Discussions
Is It Just Me? (1014)
Intel Core i7 920 heat issue help p.. (19)
I need help building a computer. 40.. (33)
Best gaming GPU for $200 or less? (17)
Nvidia GeForce gt 220 problems (21)
Trouble connecting to Apartment Int.. (16)
net use command (13)
cant find drivers (8)
Wireless coverage over 3 hotel floo.. (17)
Laptop Battery issue? (10)
Zombie Cookies Privacy Lawsuit Targ.. (6)
Rate My First Computer Build (8)
new video card- screen changes to c.. (8)
Geforce vs. Radeon? (20)
Recent Discussions
Trouble connecting to Apartment Inter.. (16)
Wireless coverage over 3 hotel floors (17)
Can't open zip files in vista??? (16)
Rate My First Computer Build (8)
Server 2008 "read only" (0)
120G External Drive, USB 2.0: Works o.. (2)
Help Dell Latitude D610 Power Problem.. (6)
Intel Core i7 920 heat issue help ple.. (19)
new woot (5)
Which Graphic is better? (1)
On startup my monitor clicks forever .. (1)
Cavalier Internet (12)
Laptop Battery issue? (10)
PC turns on, gets normal post beep bu.. (0)
D drive failure? (3)
In need of Help! (1)
DVD Recorder Set-Up (3)
System fans not working (2)
good video card around 100-200 dollar.. (3)
Linux had disk space full (3)
Minidump Help (1)
I need help building a computer. 400-.. (33)
cant find drivers (8)
Redirect malware won't go away (6)
laptop keys broken!!1 (3)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

All times are GMT -4. The time now is 07:42 PM.
TechIMO Copyright 2010 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