Jump to content

[SOLVED] PHP <form...> post method using apache server


Recommended Posts

I am new to PHP and apache. Installed both on windows XP pro 2 weeks ago.

-apache2.2 - 'Apache Software Foundation'.

-PHP5 - php.net - The PHP Group.

 

PHP is running fine on test XP server with the exception of post, does not find objects or values.

 

I upload page to hosted unix web site and it fine.

 

I have reviewed apache httpd.conf and php.ini and cannot determine disconnect regarding the post.

 

Sample code:

*******************************************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Home Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<form action="home.php" method="post" target="_self">

hello world

<input name="tagit" type="text" value="z12">

<input name="test" type="submit">

<?php echo $tagit ?>

<?php echo $_POST[$tagit]; ?>

</form></body>

</html>

****************************************************

You should use $_POST['tagit'] not $_POST[$tagit]

 

$tagit will only work if a setting called register_globals is enabled within the php.ini. register_globals has been disabled by default when PHP is installed, as it can cause a security exploits within your code. You can enable this setting if you wish however it is not recommended to. This is why your website site works fine however your local dev website (Win XP2) doesn't.

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.