POST in Apache server
| From: | Emiliano | Date: | Sat, 16 Dec 2006 01:46:28 +0000 |
| Subject: | POST in Apache server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-245873@lists.php.net to get a copy of this message | ||
Hi all,
I'm new in the php world and I have a problem. I want to invoke a php script from a web page
hosted on an Apache server. The php script writes and deletes a file but, to be able to do that, I
have to make the user to be myself and not the Apache server. In order to do that below is the code
I use in the html to invoke the php script:
<form action="http://www.aa.dd.cc/cgi-bin/cgiwrap/user/script.php"
method="post">
value1 *: <input type="text" name="val1"><br>
value2 *: <input type="text" name ="val2"><br>
</form>
where script.php is placed inside ~/user/public_html/cgi-bin
The problem is that when the script is launched, as soon as the html in visited, I get this error:
PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/script.php on line 14
PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/script.php on line 16
In other words, the POST issued inside the html seems not to work because the values val1 and val2
are not found.
If instead I do the following in the html code:
<form action="script.php" method="post">
value1 *: <input type="text" name="val1"><br>
value2 *: <input type="text" name="val2"><br>
</form>
having placed script.php in the same directory where the html is, the POST succeeds but of course
the script is not able to delete the file it is supposed to work on because the owner becomes the
apache server.
I need the first method (script.php inside cgi-bin) to work.
Does anybody know the way to solve the problem?
Any help will be appreciated,
thanks,
-emiliano
------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada16dic06