Jump to content

POST/GET data not working in new install of Apache 2.2.6 / PHP 5.04 on XPSP2


Recommended Posts

I moved to a new laptop and after installing apache/php/mysql on it successfully, I copy my php files and database over, but my XP SP2 install of Apache 2.2.6, PHP 5.2.4 and MySQL 5.0.4 is having trouble with POST data.  I get 'Undefined index' or 'Undefined constant' errors everywhere a value is sent with POST through a form. 

Link to comment
Share on other sites

This is generally caused by poor programming. They are 'Notices' and as such can be switched off by the right error reporting level in your php.ini. Bets to fix the code though.

 

1. Are you checking the indexes are set before trying to use them?

2. Make sure your indexes are surrounded by quotes, array keys are strings.

 

eg;

 

<?php

  // good.
  if (isset(_POST['var'])) {
    $var = $_POST['var'];
  }

  // instead of (bad).

  $var = $_POST[var];

?>

Link to comment
Share on other sites

Yes, should have been a little clearer with my hints, have a look at the error_reporting directive within your php.ini. Still though, IMO your best off to keep the error reporting where it is, fix your existing code and get in the habbit of creating well formed code in the first place.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.