TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-18-2007, 12:45 AM   #1 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default reading from a form

PHP Code:
if(!isset($_POST[$sd_Burning])) {
  
$sd_Burning "";
  } else {
    
$sd_Burning $_POST[$sd_Burning];

PHP Code:
<input type="checkbox" name="sd_Burning" /> Burning 
This is the code im using when my form is submitted. All should but doing is checking if the checkbox sd_Burning is checked or not. But it does nothing. the second is my checkbox in the form.

Any ideas what im doin wrong here?

Last edited by CoryMathews : 11-18-2007 at 02:24 PM.
CoryMathews is offline  
Reply With Quote
Old 11-18-2007, 12:54 AM   #2 (permalink)
The Contributor
Upcoming Programmer 
 
Matt83's Avatar
 
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
Matt83 is on a distinguished road
Default

well im no expert but i think the problem is the double $, it should be:

$_POST[sd_Burning]

also make sure your form method is set to post.
__________________
http://www.mattvarone.com
Matt83 is offline  
Reply With Quote
Old 11-18-2007, 04:40 AM   #3 (permalink)
The Wanderer
 
Join Date: Nov 2007
Posts: 20
Thanks: 1
iisbum is on a distinguished road
Default

You're using $sd_Burning to index the $_POST array, so it depends on the value stored in that variable.

You probably mean't to use:
PHP Code:
$_POST['sd_Burning'
Mubs
iisbum is offline  
Reply With Quote
Old 11-18-2007, 04:43 AM   #4 (permalink)
The Acquainted
 
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
Andrew is on a distinguished road
Default

Also, you need to have a value stored in the checkbox by using the html attribute value. Thus, the $sd_Win_Burning will actually have a value if it is set via the form.
Send a message via AIM to Andrew Send a message via MSN to Andrew
Andrew is offline  
Reply With Quote
Old 11-18-2007, 10:52 PM   #5 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

ye it was the second $. Thx guys.. And for checkboxes you dont have to set a value cause it comes back as either "on" or "off" but other fields i think you are correct Andrew.
CoryMathews is offline  
Reply With Quote
Reply



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

Advanced Search
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

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


All times are GMT. The time now is 09:06 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design