[PHP] POST in Apache server
Hi all, I'm new in the php world and I have a problem. I want to invoke a php scr= ipt 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=3Dhttp://www.aa.dd.cc/cgi-bin/cgiwrap/user/script.php; meth= od=3Dpost value1 *: input type=3Dtext name=3Dval1br value2 *: input type=3Dtext name =3D val2br /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 v= isited, I get this error: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/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=3Dscript.php method=3Dpost value1 *: input type=3Dtext name=3Dval1br value2 *: input type=3Dtext name =3D val2br /form having placed script.php in the same directory where the html is, the POS= T 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST in Apache server
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=val1br value2 *: input type=text name =val2br /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=val1br value2 *: input type=text name=val2br /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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/script.php on line 16 http://php.net/isset -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Hi Richard, sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? -e On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-b= in/script.php on line 16 http://php.net/isset -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Did you add a submit button to the page? On 12/15/06, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
oh ok, I understand that. However, my problem is different: I need those values that instead are not found. The question is: why the POST in the chunck of code inside the html doesn't work? Why is the php script not finding the values posted in the html? Thanks, -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
On Fri, December 15, 2006 10:48 pm, Emiliano wrote: oh ok, I understand that. However, my problem is different: I need those values that instead are not found. The question is: why the POST in the chunck of code inside the html doesn't work? Why is the php script not finding the values posted in the html? It's hard to say without surfing to your site and trying it, and looking at the PHP source and HTML source. The most common answers, in order of usage, are: #1 You spelled the name=val1 and the $_POST['val1'] differently. Spelling counts. :-) #2 You don't understand the HTTP interaction, and are expecting it to do things in a way it just plain does not work. This is the hardest one to diganose and treat, as it's difficult to figure out what beginners THINK the web is doing, much less convince them that they're wrong. :-) The best solution here is to get Firefox, install the LiveHTTPHeaders extension to Firefox turn it on, visit a few simple/example sites that do what your site does to see how they work, and then visit your site to see what it does. #3 A distant third, but possible, cause, is various PHP settings such as GPC order and register_globals and that one about populating the long names can be different than one expects. Review your php.ini settings and search for GPC register_globals and, errr, long_name or long_var_name or something like that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
ok, this is what I get: preArray ( ) /pre PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/mail.php on line 18 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/mail.php on line 20 -emiliano On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST in Apache server
Hmmm... there's something wrong with the form sending its values. Try echo pre; print_r($GLOBALS); echo /pre; On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: ok, this is what I get: preArray ( ) /pre PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-bin/mail.php on line 18 PHP Notice: Undefined index: val2 in /net/people/user/public_html/cgi-bin/mail.php on line 20 -emiliano On your script page, add echo pre; print_r($_REQUEST); echo /pre; and tell us the result. On 12/15/06, Emiliano [EMAIL PROTECTED] wrote: Yes Casey, I'm using the submit button -emiliano On Fri, December 15, 2006 7:39 pm, Emiliano wrote: PHP Notice: Undefined index: val1 in /net/people/user/public_html/cgi-b= in/script.php on line 14 http://php.net/isset On Fri, December 15, 2006 8:15 pm, Emiliano wrote: sorry for bothering you, but can you please give me few more details about how to use isset to solve my problem? Well, in line 14, where you start using $_GET['val1'] or $_POST['val1'] or $_REQUEST['val1'] without bothering to check if it exists or not, put in a check to see if it exists before you try to use it. Something like: ?php if (isset($_POST['val1']){ //do something with val1 now that we know it's here } //don't do anything with 'val1' cuz she's not there ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada16dic06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php