Let me preface this by saying that this is most certainly not a code issue but a config issue. I have been able to implement the code fine on my live server, this problem only occurs on my localhost. I have 7 years experience with various web langauges so we can skip the "METHOD='POST'" comments.
I recently setup PHP and Apache (and mySQL) on my windows XP box. This is my first experience with PHP and it took me a long time to get everything working so bear with me. Everything was fine until I attempted to grab something using $_POST["mypostvar"] which returned an error saying "mypostvar" was not found while $_GET["mygetvar"] works fine.
The exact error is : "Notice: Undefined index: mypostvar".
I tried running var_dump($_POST);die; and it also returned nothing. I've tried all sorts of changes within php.ini including:
register_globals = "on"
gpc_order = "GPC"
I also tried the following things:
$_REQUEST["process"]
$HTTP_RAW_POST_DATA with always_populate_raw_post_data on
I have scoured the internet looking for a solution and so far the only thing I found was a solution that I have to pay for over on Experts-Exchange . I would really not have to pay $10 for the answer but I find developing via FTP to be unacceptable.
Version Info:
PHP Version 5.2.0RC6-dev
Apache Version:Apache/2.2.3 (Win32) PHP/5.2.0RC6-d
21 20594
I am sorry, but I don't have a clue. The only thing I could think of was the variables_order and the post_max_size parameters in php.ini.
What is the effect of omitting E,C and S like you do? Not that I can think of a logical explanation, but just to be sure I'd try the default variables_order='EGPCS'. You haven't accidentally set the post_max_size to 0, have you? No I don't think so. But still, give it a try.
Sorry I can't help you here really, but I've tried.
Ronald :cool:
It seems a little strange how you can find the GET variable, but not the POST. If the data is being sent via POST it should not show up in GET.
On the page in question, can you place this code after the POST has been submitted. It should print an array of all the input. - echo "<pre>".print_r($_REQUEST, 1)."</pre>";
I am sorry, but I don't have a clue. The only thing I could think of was the variables_order and the post_max_size parameters in php.ini.
What is the effect of omitting E,C and S like you do? Not that I can think of a logical explanation, but just to be sure I'd try the default variables_order='EGPCS'. You haven't accidentally set the post_max_size to 0, have you? No I don't think so. But still, give it a try.
Sorry I can't help you here really, but I've tried.
Ronald :cool:
Thanks for the tips Ronald but I'm still stuck :-\
I have "post_max_size = 8M" by default and I tried variables_order = "EGPCS" with no success.
I'm so ideologically opposed to paying for information like this but it's to the point where I've wasted far more money in time spent on this issue. I will have to resort to Experts-Exchange if I don't get any more tips in the next day. When I do find the answer I will be sure to post it back here.
It seems a little strange how you can find the GET variable, but not the POST. If the data is being sent via POST it should not show up in GET.
On the page in question, can you place this code after the POST has been submitted. It should print an array of all the input. - echo "<pre>".print_r($_REQUEST, 1)."</pre>";
My original post was a little confusing, but it's not that information that should be in the POST is showing up in the GET. What I meant to say is that information passed in the query string is retrievable while information passed in a post is not.
URL=https://secure.experts-exchange.com/register.jsp?query=php+_post+empty&clearTAFilter=t rue&srid=zjn%2BshtK13RDZyry87R6HA%3D%3D&redirectUR L=%2Fsearch.jsp%3Fquery%3Dphp%2B_post%2Bempty%26se archType%3Dall%26Submit.x%3D0%26Submit.y%3D0&rsid= 10]Experts-Exchange[/url] . I would really not have to pay $10 for the answer but I find developing via FTP to be unacceptable
An easy way around Experts-Exhange (at least existing answers) is when you have found the answer through Google to click on "Cached". It'll show the answers plain as day. :-)
Sean
An easy way around Experts-Exhange (at least existing answers) is when you have found the answer through Google to click on "Cached". It'll show the answers plain as day. :-)
Sean
Perhaps you have a better method than I but i believe EE places their "pay for" answers in spot blocked in their robots.txt so spiders (ie: search engines) can't find/cache it. This is what I get when I attempt to use Google Cache
Did you try printing the $_REQUEST array as I suggested? It should show everything passed in via cookies, post and get. See if anything shows up after your post send. It will at least determine if the data is even reaching php.
Did you try printing the $_REQUEST array as I suggested? It should show everything passed in via cookies, post and get. See if anything shows up after your post send. It will at least determine if the data is even reaching php.
oh sorry, yes I had already tried _REQUEST as well ... no luck
Perhaps you have a better method than I but i believe EE places their "pay for" answers in spot blocked in their robots.txt so spiders (ie: search engines) can't find/cache it. This is what I get when I attempt to use Google Cache
Hmm. Works for me. Here's what I do: - Do a search on Google
- Find an EE link
- Click on "Cached" (down below) instead of the result link
Anyhow, do you have code we could look at? Not to insult your posts, but I haven't seen any code yet.
Thanks!
Sean
Hmm. Works for me. Here's what I do:- Do a search on Google
- Find an EE link
- Click on "Cached" (down below) instead of the result link
Anyhow, do you have code we could look at? Not to insult your posts, but I haven't seen any code yet.
Thanks!
Sean
Yes some EE links are cached by google but not all. If you could find a cached version of the page I need I would be deeply in your debt.
As for my code it's incredibly simple: -
<?
-
print "_REQUEST['process']:" . $_REQUEST['process'] . "<br>";
-
?>
-
And the form looks like this: -
<form action="ecard.php" name="frm" method="POST" onSubmit="return validateForm(this);">
-
<input type="hidden" name="process" value="free">
-
<input type="hidden" name="postcardHTML" value="">
-
Recipient's Email Address:<br><input type="text" size="40" name="emailTo"><br>
-
Sender's Email Address:<br><input type="text" size="40" name="emailFrom"><br>
-
Email Subject:<br><input type="text" size="40" name="subject"><br>
-
Message:<br><textarea name="message" rows="10" cols="40"></textarea><br>
-
<input type="button" value="preview" onClick="showPreview()"> <input type="submit" value="send">
-
</form>
-
I am totally confused about this. I copied your code, made a JS function to do a validate and ran it (only thing I did not include was the preview routine). And without errors it shows up in the $_POST of the called script!
So I wonder, is there something in the JS validateForm that can cause this? I am no JS expert, but at least we could try to exclude all possible errors.
If you take the onsubmit validation call out of the form, does it work then?
Ronald :cool:
Ok, I see you're trying to access request directly - don't bother. Try printing the entire REQUEST array just to see what it contains when you run your code.
I would try stripping down your form of all javascript calls, to see if they're the root of the problem. In fact, I just did it for you. I ran the form and I printed everything fine: -
<form action="index.php" method="post" >
-
<input type="hidden" name="process" value="free" />
-
<input type="hidden" name="postcardHTML" value="" />
-
Recipient's Email Address:<br><input type="text" size="40" name="emailTo" /><br>
-
Sender's Email Address:<br><input type="text" size="40" name="emailFrom" /><br>
-
Email Subject:<br><input type="text" size="40" name="subject" /><br>
-
Message:<br><textarea name="message" rows="10" cols="40" ></textarea><br>
-
<input type="submit" value="send" />
-
</form>
-
Then ran this: -
echo "<pre>".print_r($_REQUEST, 1)."</pre>";
-
And the output: -
Array
-
(
-
[process] => free
-
[postcardHTML] =>
-
[emailTo] => asxas
-
[emailFrom] => xasxax
-
[subject] => asxasxas
-
[message] => xasxasx
-
)
-
Look at your javascript for debugging.
[edit]
Heh, I see I was beaten to the punchline. =]
I tried running the same submit with zero javascript and with the generic _REQUEST with the same results. It does not surprise me that ronverdonk was able to run the code just fine because I do not think this is a code issue, rather it is a configuration issue with either apache or php.
I tried running the same submit with zero javascript and with the generic _REQUEST with the same results. It does not surprise me that ronverdonk was able to run the code just fine because I do not think this is a code issue, rather it is a configuration issue with either apache or php.
And if you run it with $_POST? Using $_POST is more secure anyway, since it is a direct reference to the posted items and does not allow you to accept $_GET variables.
Sean
And if you run it with $_POST? Using $_POST is more secure anyway, since it is a direct reference to the posted items and does not allow you to accept $_GET variables.
Sean
Yes, I have tried _POST as well and everything else under the sun... again, this is not a code issue
Ok, in that case - HOW did you go about installing apache and PHP on your machine? Did you download and install the components individually? Did you use a pre-packaged, pre-setup installer that contains both apache and php? Have you tried removing the php/apache install and re-installing it, either using the same method you used before, or another method? Have you looked at the apache config, or just the php config?
Ok, in that case - HOW did you go about installing apache and PHP on your machine? Did you download and install the components individually? Did you use a pre-packaged, pre-setup installer that contains both apache and php? Have you tried removing the php/apache install and re-installing it, either using the same method you used before, or another method? Have you looked at the apache config, or just the php config?
I downloaded and installed each individual component which took me quite some time as it was the first time I had done so. For this reason I am quite reluctant to start from scratch. If you can recommend a good "pre-packaged" number I would greatly appreciate it.
Incidentally I found a friend with a paid EE account and they retrieved the solution to the issue which doesn't help me in the slightest.
Hi! All,
Thank you so much for all your replies. The problem was with the my Plesk control Panel "View Site" issue. I could figure out and it's fine now.
Regards,
S:
I am puzzled too... but I wonder if you could check all configuration files, including the top-level .htaccess file for something like this:
< Limit POST >
Order deny,allow
Deny from all
< /Limit >
I am puzzled too... but I wonder if you could check all configuration files, including the top-level .htaccess file for something like this:
< Limit POST >
Order deny,allow
Deny from all
< /Limit >
I am submitting data from a php webpage form to a database using a php script executed by an xmlhttprequest. The problem I am having is that I am submitting thie data via the URL with GET, but I am not getting anything from $_GET['variable-name'] in my php script. As far as I can tell, my php script looks fine, I can figure out why the data is not getting through. Can someone spot the problem?
this is my php webpage
and this is my php script -
<?php
-
$connect=pg_connect("dbname=DatabaseName host=localhost user=User password=password");
-
if (!pg_connection_busy($connect))
-
{
-
$customer_name = $_GET["customer_name"];
-
$customer_address = $_GET["customer_address"];
-
$customer_contact_no = $_GET["customer_contact_no"];
-
echo "1 . $customer_contact_no . 2 . $customer_address . 3 . $customer_contact_no";
-
$result=pg_query($connect, "insert into customer values('$customer_name', '$customer_address', '$customer_contact_no')");
-
echo "New customer added";
-
}
-
?>
-
I had the same issue with localhost but 127.0.0.1 worked.
When I tried to use 127.0.0.1/test.html the $_POST worked.
When I tried to use localhost/test.html the $_POST would not work.
But when I entered just 127.0.0.1 I received a request for a login. After fixing this issue the original issue with localhost not passing $POST was fixed. Here is what steps I took which seemed to fix the issue.
Within the IIS application I went to Directory Security and confirmed the anonynomous login was enabled. I then went to Internet Explorer and open Internet Options /Security/ Local Internet / Sites / Advance/ and added http://127.0.0.1
I closed Internet Explorer and restarted IIS.
Every thing started working.
Hope this helps.
Guy
i have just managed to solve this problem that i was facing. this could be unrelated to the specific problem here, but it may help others.
i had a site which was running SSL .. i had a mod rewrite in an .htaccess file that forced everything over SSL.
i was posting to the non SSL url, which meant that the post data was not getting through to the PHP.
spent nearly a day going over this, and it was one little "s" that was missing.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Winston Kotzan |
last post by:
Is there a PHP function that will enable me to find out if a page was called
with POST or GET variables?
Thanks.
--
Winston Kotzan
http://www.wakproductions.com/
|
by: Neal |
last post by:
Hi All
When using a webrequest Post or Get , I keep getting an empty response
stream (it is supposed to be an XML file returned via a call to some Systems
GetXMLFileAPI)
If i paste the URL...
|
by: Ian |
last post by:
On the web site: (www.mvps.org/access/) I found a lovely piece of code that
retrieves the operating systems name, build number, service pack etc. Is
there something similar to retrieve information...
|
by: Roy Gourgi |
last post by:
Hi,
I am used to working in Visual FoxPro and I would like to be able to create
a database and store and retrieve information from it. What is the simplest
way to do it and what should I be...
|
by: ElanKathir |
last post by:
Hi ,
What is the different between Post and Get mothed in ASP.Net ?
Thanks & Regrads
Elankathir,
B'lore,
India.
|
by: Duffman |
last post by:
Hello,
I am working with dynamically created WSDL's and I need to change the
transaction urls from http to https in the WSDL without redirecting customers
to a different location. (I'm using vs...
|
by: James Wong |
last post by:
Hi everybody,
I would like to know how to retrieve information from AssemblyInfo.vb inside
web service. I've tried many different ways including GetExecutingAssembly
or similar method but all...
|
by: tromton |
last post by:
hello all,
ive been wondering latley if someone could change a get variable, so he can change a sql statement that way, that he could delete data from my database.
the following ive thought of:
...
|
by: Curious |
last post by:
I'm developing a proprietary system in C#.NET. The assembly is in a
folder accessible by outside people.
Since it's critical that others don't know what it's about and how
it's implemented, I...
|
by: mistersulu |
last post by:
Hi all:
I'm using a wx.ListView object with a multi-threaded wxPython app.
The list is dynamically generated and accessed across two or more
threads. In spite of the fact that I have checks to...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
| |