On 28 May 2011 at 14:11, Igor Konforti <php....@confiq.org> 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 <nickpa...@gmail.com> 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

Reply via email to