»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 06-25-2003, 07:41 PM   #1 (permalink)
Registered User
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,237
embj is on a distinguished road
Send a message via AIM 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 07-07-2003, 07:51 PM   #2 (permalink)
Registered User
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Yuma, AZ
Posts: 2,484
Praetorian is on a distinguished road
Send a message via ICQ to Praetorian Send a message via AIM to Praetorian Send a message via Yahoo to Praetorian
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 07-07-2003, 09:24 PM   #3 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
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 07-08-2003, 12:46 AM   #4 (permalink)
Registered User
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Yuma, AZ
Posts: 2,484
Praetorian is on a distinguished road
Send a message via ICQ to Praetorian Send a message via AIM to Praetorian Send a message via Yahoo to Praetorian
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 07-08-2003, 06:08 AM   #5 (permalink)
Registered User
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,237
embj is on a distinguished road
Send a message via AIM 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 07-08-2003, 10:34 PM   #6 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
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 07-10-2003, 12:09 AM   #7 (permalink)
Registered User
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,237
embj is on a distinguished road
Send a message via AIM to embj Send a message via Yahoo to embj
Say what?
embj is offline   Reply With Quote
Old 07-10-2003, 12:41 AM   #8 (permalink)
Registered User
 
Praetorian's Avatar
 
Join Date: Oct 2001
Location: Yuma, AZ
Posts: 2,484
Praetorian is on a distinguished road
Send a message via ICQ to Praetorian Send a message via AIM to Praetorian Send a message via Yahoo to Praetorian
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 07-10-2003, 12:54 AM   #9 (permalink)
Registered User
 
embj's Avatar
 
Join Date: Dec 2002
Location: Fayetteville, NC
Posts: 1,237
embj is on a distinguished road
Send a message via AIM 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 07-10-2003, 08:03 PM   #10 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
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; 07-10-2003 at 08:05 PM.
qball is offline   Reply With Quote
Reply




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

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 On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 04:16 AM.