Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 11-06-2007, 08:22 AM   #1 (permalink)
Contributing Member
 
Join Date: 10-20-03
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

chrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebody
Some quick php help needed

I have a contact form in php format. The results are e-mailed to me.

I'm having a problem getting an indication of whther the Subscribe field is checked or not checked. The other fields (text fields) come through fine.

Can anyone suggest what I need to put on the Subscribe line to tell me if the checkbox has been checked or not?

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Postal Address: $postal \n
Subscribe: $subscribe \n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n


thanks in advance if you can help on this!
chrisnrach17 is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-06-2007, 11:03 AM   #2 (permalink)
Contributing Member
 
stewart's Avatar
 
Join Date: 02-09-07
Location: New Orleans, LA
Posts: 170
iTrader: 0 / 0%
Latest Blog:
None

stewart is liked by many
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart
Assuming that $subscribe is equal to the $_POST vars from your checkbox then...

if($subscribe==true){
echo('Box Checked!');
} else {
echo('Box NOT Checked!');
}
__________________
stewart:howe
New Orleans Web Developer
stewart is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-07-2007, 01:53 AM   #3 (permalink)
Contributing Member
 
Join Date: 10-20-03
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

chrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebodychrisnrach17 is liked by somebody
thanks. however when I pasted that code and tested the form the Box Checked! message appeared on the webpage - rather than on the e-mail results I receive.

any ideas?

Last edited by chrisnrach17; 11-07-2007 at 01:58 AM..
chrisnrach17 is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-07-2007, 07:09 PM   #4 (permalink)
Contributing Member
 
Join Date: 06-11-07
Posts: 238
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the rough
Code:
$subscribe = ($subscribe ? "checked" : "not checked");
idk if that'll work but try putting it before your $message = "today.... line
Capo64 is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-07-2007, 07:21 PM   #5 (permalink)
Contributing Member
 
Join Date: 01-01-04
Location: Kansas, America!
Posts: 120
iTrader: 0 / 0%
spacefem is liked by somebodyspacefem is liked by somebodyspacefem is liked by somebodyspacefem is liked by somebodyspacefem is liked by somebody
the way php works, if a checkbox is left blank, it doesn't show up in your POST vars. so if it's really a big deal use radio options, otherwise use an if statement of some sort...

if (!subscribe]) {
$subscribe = "No!";
}
__________________
spacefem.com
spacefem is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

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



Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 05:10 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.