Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Same code different PHP builds-->problems
August 9, 2004, 10:42 pm
rate this thread
I am having a bit of trouble with my site on two different hosting
Here at work, I am running Mandrake10 Official, but Speakeasy is running
PHP with different compile options. I've already had to add "_COOKIE"
and "HTTP_POST_VARS" to my code to allow for this, but something else is
apparently amiss as well.
Everything looks fine when testing locally, but from the speakeasy site,
I get this in all my textboxes:
<br /><b>Notice</b>: Undefined index: CompFax in
<b>/mnt/webhosting/sites/d/deluxestitcher.com/order.php</b> on line
It apparently only appears in boxes for which no cookie has been stored
in the browser.
Here's the page with problems:
Could someone please tell me the hopefully quick & easy solution to this?
Here's a small code snippet:
<td colspan="8"><div align="right"><table width="100%" border="0"
<tr><td align="left"><input id="CompanyFax" value="<?php echo
$_COOKIE["CompFax"] ?>" type="text" name="CompanyFax" size="34"
Speakeasy's info.php can be found here:
My local info.php can be found here:
Re: Same code different PHP builds-->problems
You can use isset() or empty() to make sure that the variables are set
before using them. Alternatively if you know this is okay you can simply
disable the notices -- see http://www.php.net/error_reporting
Be careful here too; if the cookie is set from user-supplied data it
could break your HTML output if a double-quote or other special
character is typed. (Consider also the possibilities of malicious
attacks inserting arbitrary HTML via your forms.) Consider using
htmlspecialchars() to escape output.
-- brion vibber (brion @ pobox.com)