Jump to content

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


harry15106

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.