Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Using $ GET And $ POST From Same URL


I am finishing off a new payment gateway script for the Shop-script Pro shopping cart and have run into a problem reading $_POST variables being sent back from the payment processor.

I supply the payment processor (paymate) with a return URL which has some variables in the URL string (?status=success&processor=paymate).

The payment processor constructs a confirmation page with a form which uses my return URL as a form action and a set of hidden fields which details of the transaction itself.

When I try to read the POST variables, they are not there. I am trying to figure out why that might be.

One possibility is that the URL I provide has GET variables in it, so maybe the PHP receiving page recognises this and will not try to read POST variables, even though I ask it to?

Another possibility is that Shop-script does not call the actual PHP script with the $_POST array reader as the return URL, but instead uses "[domain.com]?blah" (which calls index.php and it then calls the actual PHP receiving page (adding the header/footer/etc added in the process), therefore losing the POST data?

Is one of these more likely than the other? Any thoughts on how I might get around it without rewriting Shop-script completely?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Post And Redirect With Post Data
The solution we have though up is the following:

1. The user fills in data in a form and hits submit
- This submits (POST) to another page (redirect.php)
2. redirect.php adds more POST data to POST and then submits all this POST data to another page (offsite [payment portal])

The reason why we have to do this is for someone who knows our to read html source code, could easily find the sucessful page which will then do the processing we need to do on our side. Which means freebeis.

Calling A Post Script From A Post Script; Curl Works But ...
I am trying to call a php script B from script A.

However, when I do this with curl everything works fine except the url of the script is the url of script A. How can I make the URL the URL of script B.

Is this possible with curl?

PHP Post, Then HTML Post?
Using PHP, I want to POST or GET some variables to a second php page.
This, I already know how to do.

However, on the second php page, I want to use a simple, standard HTML
form using the standard form-submitting method such as:

<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

whereupon both sets of variables --- the earlier variables that were
POSTed or GETted to the second page, along with the standard form
variables derived within the second page --- will be POSTed to the
above URL.

In the second page, might I actually translate the received variables
into actual HTML code? For instance, if my first page POSTed the
variable xyz to the second page, then might the following code on the
second page receive that variable and then include it when the second
page's "Submit" button is pressed?

<? $xyz=$_POST['xyz']; ?>
<INPUT TYPE="HIDDEN" NAME="xyz" value="<?=$_POST['xyz']?>" >

Or how, otherwise, might this be done?

How To POST Using PHP ?
I am fairly new to PHP, I am not sure if what I want to do can be done. I have done some research but cannot find the asnwer.
Here is the problem. I have a Perl script that is called from and HTML form, with some hidden inputs, that uses POST method. The user has to enter some text input into the form and click 'Submit" button.

What I want to do is have my PHP script call the Perl script and pass similar information but obtained from a mySQL database, rather than the user form. How can I have my PHP simulate POST method?

Post And Get
I recently re-installed windows and with that apache, mysql and php. I've downloaded the new php version and now I have this problem. In my script I use post and get methods and now they aren't working anymore.

I've tried several things but when I use a form with post or get or and hyperlink (e.g. index.php?name=1) the page I go to doesn't recieve the values for some reason. I've tried a print() at the 1st line of the script so I know I don't have some code messing up, but they're empty.

Post To Self?
if test.php is this file:

<?php
$lang = $_POST["lang"];
print $lang;
?>

<form method=post action=test.php>
<input type=image src=engFlag.jpg name="lang" value=en>
<input type=image src=fraFlag.jpg name="lang" value=fr>
</form>

Post/get
Is there a way to sent data using hyperlink (GET routine) and retrieve it in $_POST array?? something like...

echo '<a href="boss.php?foo=bar" method="POST">link text</a>'
doesn't work (I retrieve data in $_GET) Is there another way?

POST Var
I'm trying to retrieve a file location, and then insert it into mysql as a longblob - but that is beside the point. I have a simple HTML form with <input type="file"... /> which should store the path selected, and that path should then be sent to a post var on 'submit'.

My problem is, the path is not showing up! It shows up in the HTML form, but when I submit the form, nothing is in the POST array representing it. Other form elements pass, but not the type="file". Is this some type of PHP issue with the way it handles HTML Forms? Code:

PHP Pre 4.2 VS. PHP Post 4.2
My local PHP install (for development/learning) is 4.3, but my hosting
service uses 4.0.6. Without turning on registered globals, is there a
common way these two versions can handle form data? 4.0.6 doesn't have
import_request_variable(), $_POST, or $_REQUEST, and 4.3 chokes on
$HTTP_POST_VARS[].

GET And POST
I just started learning PHP and got really confused by how PHP
receives varables from HTML form. I'm using PHP 4.3.9 downloaded from
php.net. In my html file I use POST to send variable 'userfile':

Getting POST From A URL?
I have a user system where I'd like players to be able to view each others' profiles. So basically what I'm hoping for is something like...

The URL, is viewprofile.php?id=xxxxxx

Where xxxxxx is, would be that player's ID number. But what I'm wondering is how exactly if I generated that, the script would figure out what the ID was referring to. This'd also make searching for the ID easier cuz I have a cool way of doing that.

Md5 And Post
I have a signup form that encrypts the password into md5 format, which then stores it in to the database.

I then have a login section that translates the password into md5 to check against the stored version. However the one that is entered and posted via a password field, results in a different md5 hash, is this due to the nature of the password field or post, if so what is the best way to store an encrypted password and then compare it?

PHP POST
I'm doing a page (only a demo) where there are articles. I've decided to practice and make a backstage admin page where I can add, modify or delete articles, and It works fine. Ah, I forgot to tell, I'm using a MySQL database to store the articles.

And the problem: I made my admin page, where I have a form which has all the articles, and have a checkbox assigned to each and every one of them. I'm using the POST method to go to a new page where I can edit the article. So, the problem is, I want the main admin page to be able to send more article IDs with POST (if more than one checkbox is checked) and the editorial page could edit multiple articles at the same time. I thought of arrays, and stuff, but I cannot make it work!

POST Not Working...
hello. im running php/mysql/apache on linux, os x and freebsd. on os x, everything works fine, but on linux and freebsd the default install of 4.2.3 does not accept POST....i dont know how to explain but when i submit a form, the data wont be changed to variables. i checked the ./configure --help file but there was no option...i just assumed it was built in...anyways thanks for any help.

Can You Post A Value In The Header?
I used to pass values through the header, but I have reinstall PHP I can't seen to get the value to pass.

Foreach Post
I'm not asking for help, im posting help.
if anyone wants to use foreach to return post vars, here's the code:

<? if($_POST['Submit']) {
echo "yay";
foreach( $_POST as $post ) {
echo $post." = ".$_POST[$post];
}
} ?>

POST Security
I've read the FAQ allready on security and saw i'd had to start a new thread about security and it's about .. yes security and forms.

I have a form and when I post the input from the users I want to check several things to be sure that it definitely came from my form, so not from somewhere else. I'm coding with register_globals=off so that's a good start. Now I want to be sure that it is really my form. (Maybe I'll sound a bit paranoic)
what would be more secure ?

1) checking on $_SERVER['http_referer'] ? -> easily spoofed or not and what about virtual hosts on one machine ?
2) creating session-id ? -> /tmp folder ? a hacker can always get into the machine maybe ?
3) a combination of both ?
4) something else ?

Security About POST!
I need to check and make sure users don't "hack" my post values. but im not really sure if i need to check these post values..

The values are coming from a registration form, and are the following... I will obviously check the database for existing users, or exisiting email addresses, but other then that, this code can't really be used to hack me, can it?? PHP Code:

Can't See My Post Variables
I work on an application which runs on our Intranet network, so security it's not a big issue, and my phpinfo() get me register_globals on (php 4.1.2 on a Debian system).
The problems is that I can't see my post variables (only with $_POST) and I don't get it . Is there another setting wich overrides php.ini and stop my register_globals ->on to behave properly ?

Post Method
I have an HTML form in which a user enters his/her name and once clicked submitted it should run the process form and show the name user entered. The problem is that the variable "username" is not been passed to my processvariable.php through html headers.
Code:

Question Regarding GET And POST
First off, I'm a newbie to PHP and server side scripting.

I'm curious if there are any specific guidelines as to when one should use "GET"
or "POST" in forms processing. I've had issues moreso with post than get but
have been able to resolve them relatively quickly.

Array Post
I have a form with this in:

<input type=checkbox name=test[] value=test1>
<input type=checkbox name=test[] value=test2>

Now I want to post this.
I have to check if something is clicked .I tried

if (!isset($_POST['test']))
echo 'no vars clicked'
else{
for ($i=0;$i<count($_POST['test']);$i++){
echo $_POST['test'][$i]."<br>";}}

anyway, it' doesn't work,if anyone can give me a tip no checking if there are vars in the array or not, would be great.

Using Post From Href
I have a large query result display php file that expects the query information to come in via $_POST and now I want to an another window that jumps to that same php file from an href with some predetermined query elements. Is there a way to have the href post the variables to the php file?

Doing An Http Post
For the benefit of others, I want to show how to do
an HTTP POST request using fsockopen(). I banged my
head against a wall for two days trying to figure
this out. I even went to http://php.net/ to find
out how to do this, but it didn't help because
my mind automagically converted the "Content-Length"
header into "Length."

I even went to find out
the specific protocol for HTTP POSTs, but I didn't
find it there. RFC 2616 (HTTP) does not give the
exact format for POST requests.

Question: Where is the format for POST requests defined?

---------------- send_post.php ---------------
<?php
// file: send_post.php
error_reporting(E_ALL & ~E_NOTICE);
$eol = "
";
$errno = 0;
$errstr = ''
$data = 'username=george&password=i81bpz'
$fid = fsockopen('localhost', 8080, &$errno, &$errstr, 30);
if ($fid) {
fputs ($fid, "POST /post/show_post.php HTTP/1.1$eol");
fputs ($fid, "HOST: localhost$eol");
fputs ($fid, "Connection: close$eol");
fputs ($fid, "Content-Type: application/x-www-form-urlencoded$eol");

// Use 'Content-Length' NOT 'Length' !
fputs ($fid, 'Content-Length: ' . strlen($data) . $eol);
fputs ($fid, $eol);
fputs ($fid, $data);
fputs ($fid, $eol);
fpassthru($fid);
}

?>
------------- show_post.php -----------------
<?php
// file: show_post.php
error_reporting(E_ALL & ~E_NOTICE);

echo "<pre>";
echo "------------ POST VARIABLES ----------";
print_r($HTTP_POST_VARS);
echo "------------ SERVER VARIABLES ----------";
print_r($HTTP_SERVER_VARS);
echo "</pre>";
?>

With Variables And POST
On my online order form, I need to send a few variables to my
credit-card processor. These variables are for non-secure customer
comments, and will be sent through the usual metod, i.e.,
<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

However, one variable is a text-area box for a detailed customer
comment, and this variable can get pretty long. But my credit-card
processor has a 256 byte maximum length limit for all POSTed
variables. However, I can add as many of these 256-byte variables as I
like.

So how can I accomplish this in the most simple, efficient, and
elegant manner? How can I break up the text-area vaiable into 256-byte
pieces and then send these variables via POST along with all of the
other form variables which will be POSTed through the usual HTML
means?

POST Medhod?
<form method="POST" action="OptionsModifier.html">
<input type="hidden" name="login" value="<?php print $_POST['login']?>">
<input type="hidden" name="password" value="<?php print $_POST['password']?>">
<input type="submit" value="DBase Interface">
</form>

when this page called the page named "OptionsModifier", it did not show me the page and the wrong information appeared below:

Method Not Allowed
The requested method POST is not allowed for the URL /testerLD/OptionsModifier.html.

PHP Post/Get Problem
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.

POST And GET Methods In Php 4.3.1
I am using PHP 4.3.1 on Mandrake 8.2. It appears that POST,GET methods are not working.

$post And $get Problem
Can i use $_post and $_get if i don´t it using a form.?

I have 3 php pages. in first page i want send a var with $post, I use
Request or get in second page and i send with $post to third page, but these
isn´t correct. I use Request or Get in third page but it don´t get anything.

PHP Will Not Post Vars.
When every I submit my form information it just puts the <?php echo
$PHP_SELF?> as part of the URL.

---------------------------------------------------------------
<html>
<body>

<?php
if ($submit){
//connect to database
//$host = "host";
//$user = "user";
//$pass = "**";
//$database = "driveaf";

$db = mysql_connect("host", "genuser", "pasword");
mysql_select_db("driveaf", $db);
//Connected to data base
//write data to db
$sql = "INSERT INTO users (empID, firstname, lastname, email,
password, reg_date, website) VALUES ('$empID', '$firstname',
'$lastname', '$email', PASSWORD('$password'), '$reg_date',
'$website')";
$result = mysql_query($sql);
echo "Thanks";
}else{
//

?>

<form method="post" action="<?php echo $PHP_SELF?>">
<p>Employee ID:
<input name="empID" type="text" id="empID">
</p>
<p>First Name:
<input name="firstname" type="text" id="firstname">
</p>
<p>Last Name:
<input name="lastname" type="text" id="lastname">
</p>
<p>email address:
<input name="email" type="text" id="email">
</p>
<p>password:
<input name="password" type="text" id="password">
</p>
<p>
<input name="submit" type="Submit" value="Submit">
</p>
</form>

</body>
</html>
-----------------------------------------------------------------------

Getting Form Name From Post
how do i get the name of a form thats just been submitted i.e. here how do i get "new_form"... Code:

Two Different POST Actions? Possible?
How do I create a form that two submit buttons, where each one
submits the form input data to a different server?

Consider this situation: I have a form where users can check various
options to subscribe to a service, and each option costs a certain
amount. When the form is submitted, my php script totals up the
options. Fine.

The form has 2 submit buttons: "print invoice" and "pay by credit
card."

The "print invoice" button is for those businesses who can't pay by
credit card but must mail us a check instead; they print an invoice
for their accounts payable department. The php script generates the
invoice based on the form inputs. Easy, no problem.

The problem is "pay by credit card." The total cost from submitted
input fields must be POSTed to a different server: our credit card
processor.

This isn't a problem if the credit card processor accepts the
form input data as a GET string in the URL; all I'd do is
header("Location: $url"); to redirect the user to the credit card
processor page which handles the payment. The problem is I need
to do this by POSTing the form input data, while at the same time
retain the ability to generate invoices from MY server using the
same form.

Post Data To A CGI
How in PHP do you send post data to a CGI and let the CGI carry on the request (what I'm doing is: a form is filled out a load of PHP to check that each option is correct and some other stuff then when its ready redirects off to a CGI but sending the form data with it (using a post rather than a get).

Post Problem
i have problem with post method , i use html form when i print value of one text input of the form , it prints the value plus the name of the text input plus the = plus the value again.

GET & POST Not Working.....
I`ve just re-installed Apache and PHP.....and now it seems like GET and POST dont work anymore....even if I am trying to set the right variables directly in the url it doesn`t work....Any suggestions?

XML Being Passed To PHP Via POST
I am using macromeda Flash to create anXML object which I pass to PHP.
I need to know how to recieve it into PHP so I can process it in PHP.
For now all I want to do is display the XML on the screen.

To start at the simplest point I am trying this:

$my_xml = $_POST;
echo $my_xml;

Of course all it echos is "Array"

If I have tried a few other things, but I am shooting in the dark.

Clearing Post
Im working on a complicated form and I have a quick question. After you submit data via Post, that data is no longer there. Right?

Can't Post To Two Tables.
I have an input form which should post information to two tables. The first table is receiving the information, but the second one isn't. I have been looking at this for ages and just can't see the problem. Code:

Is It Possible To Post Data Through Url?
Is it possible to post a value to a database through a url? Something like PHP Code:

Post Security
I can't get my head around form mail scripts and people injecting extra
code in there. I don't know if they actually achieve anything or not. I
am using a script from
Web4Future Easiest Form2Mail (GPL).
Copyright (C) 1998-2005 Web4Future.com All Rights Reserved.
http://www.Web4Future.com/
Does anyone know if that script is supposed to be secure. ?

Anyway... my point is not that much just the formmail script but any
post form and post handling script.
Is there a standard checklist of security threats I should be looking
regarding forms that send crucial data ?
For example when you send something to paypall or worldpay you have to
send an id that uniquely identifies you ok ?
Now that is visible to everyone.
But it doesn't really produce any security threat at all.

BUT if I need someone to send an id to my script and use it as a
signature to use the site services that means that someone can fake it
easily and start using the website without signing up.
I don't want people to login because they would have allready loged in
elsewhere.
Using post variables seems to be the easiest way to store data in my DB
from any other site cross platform.

Raw POST Data
Is there a way to access the raw data sent to a PHP app via POST? I'm
trying to read the XML sent by a Flash program with XML.send() and its sent
via POST but not URL encoded. PHP is expecting URL encoding so it comes in
like:

$_POST['<?xml version'] = '"1.0"?>'

Perl can read it just fine like so:

read (STDIN, $rawpost, $ENV{'CONTENT_LENGTH'});
s/&amp;/&/g;

POST Or SESSION ?
I am working on some simple pages that pass non-critical information (i.e.
no passwords, usernames, etc.)
to and from different pages. Currently, I am using FORMs w/the POST method.
I am not using any cookies or anything stored on the client end, simply
passing data.

Should I read up on SESSIONS and use those instead of POST ? What are the
benefits/drawbacks
by switching to SESSIONS ?

PHP Vs. HTML Post
I wrote a "registering" script everything works great. Now it where I got stuck is that in my script I do everything with one script. Until the last part of the script where I prompted the user to confirm. And I want to call up a function let's say "function myfunc()" when the user hit that button. How do I do this with PHP.

PHP Won't Post To Database
I really am a novice and found a script on webmonkey. Basically all I want
to do is to add records to my database. In my database I have a table called
research_main with the fields already created.

I have tried to bodge a script to work for me. it doesn't. It looks as
though it works but I get no data posted. What have I done wrong?

If you want me to put a statement in anywhere to check something please let
me know where you want me to put it as I really am useless with this.

can you tell me what is wrong with this script.

:-( I am trying honest

<html>

<body>

<?php

if ($submit) {

// process form

$db = mysql_connect("localhost", "uname", "password");

mysql_select_db("dbtouse",$db);

$sql = "INSERT INTO research_main
(date_inv,info,medium_name,place_name,date_death,v erified_event,closed_event
) VALUES
('$date_inv','$info','$medium_name','$place_name', '$date_death','$verified_e
vent','$closed_event')";

$result = mysql_query($sql);

echo "Thank you! Information entered.
";

} else{

// display form

?>

<form method="post" action="<?php echo $PHP_SELF?>">

<p>Date Of Event:
<input name="date_inv" type="Text" id="date_inv">
<br>

Information to be researched:
<textarea name="info" cols="75" rows="5" id="info"></textarea>
<br>

Medium or Researchers name: :
<input name="medium_name" type="Text" id="medium_name" maxlength="30">
<br>

Place Name: :
<input name="place_name" type="Text" id="place_name" maxlength="50">
<br>
Date of Investigation:
<input name="date_death" type="text" id="date_death">
<br>
Verified Event:
<input name="verified_event" type="radio" value="radiobutton">
Yes
<input name="verified_event" type="radio" value="radiobutton" checked>
No<br>
Event Closed:
<input name="closed_event" type="radio" value="radiobutton">
Yes
<input name="closed_event" type="radio" value="radiobutton" checked>
No<br>

<input type="Submit" name="submit" value="Enter information">
</p>
</form>
<?php

} // end if

?>

</body>

</html>

Post Headers?
I've created a form that is validated by another php script. If there is an error with the form (eg a field was left out) the script sends the user back to the form with an error statement. But all the data that was entered into the form has been lost! Is there any way to send the $_POST data back?

Php Upload Without Post ?
I was wondering if there was a way to upload a file wihtout the post method. I think I have already seen something like that in ASP... They took the binary code of the page and then reconsitued it on the server.

POST Method
I would like send variable to php script from URL
using POST method. Is possible do it ?
( <a href="xxx.php">)

POST Method
I need to make some interaction between 2 diferents php site.
For that, in 1 site I have a php function, it wait for some values on
the POST method. It verify the value and return a xml with the result
and one unique ID if all is well or the error code. This function I can
not modify it and I can not any access, I can only use it.
In my side I try to do a form with all values, put in the action the
url and submit button, but I was able to catch and work with xml,
always the xml is show in the browser, I wan not do that, I can catch
the xml, work with the xml and show some information on the browser.
(all in the same page)

Help Using The POST Method On PHP
I need to pass a value into a hidden form element by simply clicking on a link, and the value passed should be the visible name of the link itself. Can this be done without Javascript?

This php page will be accessed on mobile phones, and Javascript support on them is very limited, so I must deal with it using only PHP.


Copyright © 2005-08 www.BigResource.com, All rights reserved