Reply to Re: undefined index

Your name:

Reply:


Posted by Julien Plιe on 08/12/07 15:34

Le Tue, 24 Jul 2007 23:08:19 +0000, Nospam a Γ©critΒ :

> I am getting an undefined index : email on this line
>
> if
> (!eregi('^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+)
{1,2}',
> stripslashes(trim($_POST['email'])) )) {
> $errors[] = '<font color="red">Please provide a valid email
> address.</font>';
> } else {
> $email = mysql_real_escape_string($_POST['email']);
> }

Hi Nospam,

You assign a string to a table ??? This thing looks kinda crazy to me.
Moreover... I advice to check that the array key 'email' exists in
$_POST... It will avoid warnings.

<?php
if (array_key_exists ('email', $_POST))
{
// Do what you have to do.
}
else
{
// There you could not do it anyway.
}
?>


Julien

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация