Re: error with hosting

From: Date: Tue, 21 Apr 2009 17:02:04 +0000
Subject: Re: error with hosting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-291762@lists.php.net to get a copy of this message
®0L¥ wrote: > I have a littli application in PHP that I do with appserv, in my local > server work ok but when I upload de page.php to the hosting server don't > work, the hosting say in your page that support php and the web server is > apache because the directory is httpdocs, and why my page dond;t work in the > hosting and work ok in my local server ?? > > > //before I have a html form > > <form action="find.php" method="post"> > <tr> > <td height="24" valign="top" class="menu" > style="text-align: left"><table width="210" border="0" > cellspacing="0" > cellpadding="0"> > <tr> > <td width="7" height="23" > class="text_1"></span></td> > <td width="105"><span > class="text_1">Your Company > Name:</span></td> > <td width="98" valign="top"><input > name="cname" > type="text" size="11" maxlength="20" > align="right"></td> > </tr> > </table></td> > </tr> > <tr> > <td height="22" valign="top"><table > width="210" > border="0" cellspacing="0" cellpadding="0"> > <tr> > <td width="7" height="22" > class="text_1"></span></td> > <td width="105"><span > class="text_1">Your E-Mail > Address:</span></td> > <td width="98" valign="top"><input > name="email" > type="text" size="11" maxlength="40" > align="right"></td> > </tr> > </table></td> > </tr> > <tr> > <td height="42" valign="top"><table > width="210" > border="0" cellspacing="0" cellpadding="0"> > <tr> > <td class="text_1" width="124" > height="27"> Find by > Zip Code: </td> > <td width="86"><input name="zip" > type="text" > size="9" maxlength="5" align="right"></td> > </tr> > </table> > <table width="210" border="0" > cellspacing="0" > cellpadding="0"> > <tr> > <td class="text_1" width="90" > height="22"></td> > <td width="79"></td> > <td width="41" valign="bottom"><input > type="image" > src="images/find.jpg" width="33" height="20"></td> > </tr> > </table></td> > </tr> > </form> > > > // I try with this application in find.php > > > <? > if (!$cname) > { > echo "<font color=\"maroon\">Enter your Company > Name.</font>"; > } > elseif > (!ereg("^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email)) > { > echo "<font color=\"maroon\">Enter a Valid E-Mail > Address.</font>"; > } > elseif (strlen($zip)<5) > { > echo "<font color=\"maroon\">Enter a Valid Zip > Code.</font>"; > } > elseif (ereg("[^0-9]", $zip)) > { > echo "<font color=\"maroon\">Enter a Valid Zip > Code.</font>"; > } > else > { > echo "<font color=\"maroon\">Find an Agent close to > you.</font>"; > } > ?> > > Thanks to all. > Your code is relying on register_globals which is bad and seems to be enabled on your local server but not on your hosting server. Use the $_POST superglobal array: if (!$_POST['cname']) //etc... -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#291762) next »