TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   reading from a form (http://www.talkphp.com/general/1490-reading-form.html)

CoryMathews 11-18-2007 12:45 AM

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?

Matt83 11-18-2007 12:54 AM

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.

iisbum 11-18-2007 04:40 AM

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

Andrew 11-18-2007 04:43 AM

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.

CoryMathews 11-18-2007 10:52 PM

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.


All times are GMT. The time now is 02:59 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0