473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP Post/Get problem

Hi all,
I have been working on a simple form to collect user data. The form is
written in ASP. The target action is a PHP script on a completely different
system. The problem I have been experiencing is when I use the GET method
on the ASP form, my PHP page displays the data as collected. When I use the
POST method (preferred), very same PHP page does not display the collected
information. I have searched for anything that may give me a clue on
php.net but found nothing. Please help.

Thanks
--K

Jul 16 '05 #1
2 5984
bl******@bellsouth.net wrote:
Hi all,
I have been working on a simple form to collect user data. The form
is written in ASP. The target action is a PHP script on a completely
different system. The problem I have been experiencing is when I use
the GET method on the ASP form, my PHP page displays the data as
collected. When I use the POST method (preferred), very same PHP
page does not display the collected information. I have searched for
anything that may give me a clue on php.net but found nothing.
Please help.

Thanks
--K

1. Good god, don't cross-post to so many groups, especially when most of
them are not carried by most servers. Anyhow, on to your question -

In ASP, you access form variables by Request.Form.("VARNAME"). In PHP, it's
a bit different.

You can use either register_globals (the old method that is very frowned
upon) which lets you just use $varname, you can use $_GET['varname'] (which
only works if it's coming via GET), $_POST['varname'] ) (like $_GET but for
POST), or $_REQUEST['varname'], which is similar to ASP in that it will
search both the POST and GET inputs (if any).

Without seeing your code, I'm guessing that the script is using
$_GET['varname']. Either change this to $_POST['varname'], or if you are not
sure if you are going to use POST or GET, change it to $_REQUEST['varname'].

// Ian
Jul 16 '05 #2
bl******@bellsouth.net wrote:
Agelmar,
Thanks for your reply. The issue I am having is when using method POST from
an ASP form on a Wintel box and the target as a PHP page on a FreeBSD box.
I query the variables and they return nothing. However, when I use method
GET in the ASP form with the same target PHP page I get all the values from
the variables when they are queried. Have you seen this behavior before?
If seeing the code will help, I will get it to you in the AM.


Hi!
It _really_ doesn't matter what kind of system your web form is created
in. What matters is the html it produces. If your html looks something like:

<form method= "post" action="http://<your-php-box>/script.php">
<input name="myVar" value="default value of myVar">
<input type="submit">
</form>

then you could access the variable myVar with the following PHP code:
<?php
echo "Value of myVar is now ".$_POST["myVar"];
?>

If, however, your html looks like this:
<form method="get" action="http://<your-php-box>/script.php">
<input name="myVar" value="default value of myVar">
<input type="submit">
</form>

you could use:
<?php
echo "Value of myVar is now ".$_GET["myVar"];
?>

Really, it's that simple. As mentioned earlier, this would work in both
cases:
<?php
echo "Value of myVar is now ".$_REQUEST["myVar"];
?>

//marius

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: brendan | last post by:
Sorry this isnt a cross post .. i just didnt get any help from alt.php. I have a website which utilises post forms for navigation in some areas. Problem is, when *some* users hit the BACK button...
3
by: sammmista | last post by:
hello experts, Plz dont treat this as another newbie query , i did my homework but still getting nowhere :( :( :( Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to post data...
12
by: Jan Roland Eriksson | last post by:
I have worked some more on this suggested new mFAQ version trying to get all user input to blend into the text. Another review by the NG would be welcome. ===== Archive-name:...
5
by: Jan Roland Eriksson | last post by:
Some more fine tuning and inclusion of last suggested text from regulars has been done to this test post #4 of the mFAQ. As usual, rip it up anywhere you feel that it's appropriate to do so. ...
1
by: khawar | last post by:
my application is in asp.net using C# hi guys having a complicated problem i am using payflowlink to process CC payments I have to send a httppost to their servers. The problem is how do i do a...
4
by: Ollie | last post by:
I have wrriten a reverse proxy for a client of mine, this reverse proxy takes the url takes it attempt to access a *.XXXX and returns the the contents of an aspx web page from another internal...
0
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
3
by: bb nicole | last post by:
Below is my job post code, it cannot post into database... WHAT IS THE PROBLEM OF IT?? <?php session_start(); ob_start(); //connect to server and select database
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.