Re: Re: how to use echo checkboxes in php when i don't have access to $_POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28 May 2011 at 14:11, Igor Konforti <php.net@xxxxxxxxxx> wrote: 

> It means that array $_POST does not have a key called "negin".
> Simple If statement before line 4 would fix this.

> On Sat, May 28, 2011 at 16:03, Negin Nickparsa <nickparsa@xxxxxxxxx> wrote:

>> suppose that i have this SIMPLE code:
>> <?php
>> echo"<input type='Checkbox' name='negin'  value='yes' checked />";
>> echo $_POST['negin'];
>> ?>
>> <html>
>> <head>
>> <body>
>> <form method="post">
>> </form>
>> </body>
>> </head>
>> </html>
>> error is this:
>> Undefined index: negin in *D:\phpweb\negin2.php* on line *4*
>> *
>> *
>> *how can I correct this?*

For one thing you need to have the PHP code inside the <form></form>. Second you don't need to echo the <input>, just write that straight into the HTML. And you need to use the isset() function so you don't try to echo $_POST['negin'] unless it it is set.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux