473,387 Members | 1,678 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.

POST variables with a form

Gav
I'm wanting to send POST data to a script, but without it being sent via
the action of a form being posted - in other words I want to re-direct
to a page but have the POST data filled in for the page to deal with.

Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.

--
Gav
Aug 1 '07 #1
5 1880
On Aug 1, 1:09 pm, Gav <g...@dentrassis.comwrote:
I'm wanting to send POST data to a script, but without it being sent via
the action of a form being posted - in other words I want to re-direct
to a page but have the POST data filled in for the page to deal with.

Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.

--
Gav
Instead of using post, you could send the data on the address bar
using GET instead of POST. You use it basically just like $_POST,
except that you use $_GET instead, all of the variables are passed in
the url with get as well, which maybe would make this method unuseful.

Aug 1 '07 #2
On Aug 1, 1:09 pm, Gav <g...@dentrassis.comwrote:
I'm wanting to send POST data to a script, but without it being sent via
the action of a form being posted - in other words I want to re-direct
to a page but have the POST data filled in for the page to deal with.

Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.

--
Gav
Or add your variables and data directly to the URL to make the
receiving script think the form was posted with GET method.

Aug 1 '07 #3
Rik
On Wed, 01 Aug 2007 20:09:27 +0200, Gav <gc@dentrassis.comwrote:
I'm wanting to send POST data to a script, but without it being sent via
the action of a form being posted
Which is perfectly possible using CURL or more wordy with a normal
fsockopen/fwrite.
- in other words I want to re-direct
to a page but have the POST data filled in for the page to deal with.
The redirection is not really possible: the client doesn't know what post
request to send, and at any rate: posts aren't send anymore on a redirect
Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.
Nope. If however the receiving script has the same domain, you can just
request the page yourself on the server and output that directly to the
user (possibly including headers). Perfectly possible, but a nightmare for
relative links. You could consider trying to force a <basetag in the
head, but I'd call it far from reliable. And your page is offcourse not
bookmarkable at all.

--
Rik Wasmus
Aug 1 '07 #4
Gav
In article <11**********************@22g2000hsm.googlegroups. com>,
dkruger <da*********@techie.comwrote:
On Aug 1, 1:09 pm, I wrote:
I'm wanting to send POST data to a script, but without it being sent
via the action of a form being posted - in other words I want to
re-direct to a page but have the POST data filled in for the page to
deal with.

Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.
Instead of using post, you could send the data on the address bar
using GET instead of POST. You use it basically just like $_POST,
except that you use $_GET instead, all of the variables are passed in
the url with get as well, which maybe would make this method unuseful.
Firstly, I should just point out that I got the subject line wrong, it
should have read _without_ a form - oops! Hopefully everyone understood
from the my posting what I was meaning.
Anyway, thanks for your suggestion David. I didn't want to use GET as I
don't want the data to be visible, and in any case, that still means
changing the way the receiving script(s) handles the data that is
passed to it, which I didn't want to have to alter. If was going to
alter the original scripts I would make them use session control.

--
Gav
Aug 1 '07 #5
Gav
In article <op.tweaxlbcqnv3q9@metallium>,
Rik <lu************@hotmail.comwrote:
On Wed, 01 Aug 2007 20:09:27 +0200, Gav <gc@dentrassis.comwrote:
I'm wanting to send POST data to a script, but without it being sent
via the action of a form being posted
Which is perfectly possible using CURL or more wordy with a normal
fsockopen/fwrite.
Thanks, I'll look at the CURL functions and see it will do what I want.
- in other words I want to re-direct
to a page but have the POST data filled in for the page to deal with.
The redirection is not really possible: the client doesn't know what
post request to send, and at any rate: posts aren't send anymore on a
redirect
Is there a way to do this without using Session control?
I don't really want to go and change a whole bunch of old scripts to
implement sessions, so I was hoping to be able to use something like
header() to fill in the $_POST array before redirecting.
Nope. If however the receiving script has the same domain, you can just
request the page yourself on the server and output that directly to
the user (possibly including headers). Perfectly possible, but a
nightmare for relative links. You could consider trying to force a
<basetag in the head, but I'd call it far from reliable. And your
page is offcourse not bookmarkable at all.
That's an interesting idea - I'd not thought of doing that.
Thanks Rik for your suggestions.

--
Gav
Aug 1 '07 #6

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

Similar topics

3
by: Robert | last post by:
Hello, Can anyone help with this? 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...
2
by: Robert | last post by:
Can anyone do this? 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...
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
2
by: CCP | last post by:
I've got a simple HTML page containing a form and a few hidden variables. This form post into a .Net application (that lives in a seperate directory). The first thing I do in my codebehind is...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
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...
6
by: Carlo | last post by:
I have an html form that posts onto an asp.net page (vs2005). The form header is as follows: <form action="thankyou.aspx" method="post">. In a table i have the fields <td><input id="email"...
4
by: dac | last post by:
I am quietly going insane on this project. I've never worked on a project like this one before. All my previous sticky forms were for data entry, not editing. I don't know how to display the form...
3
by: Vic Spainhower | last post by:
Hello, I have an HTML table that is being constructed from a MySQL table and displays a form that includes a check box on 1 of the fields on the form for each record. I have included in this PHP...
4
by: SupraFast | last post by:
I have 2 forms on one page. I have hidden variables in each form, with separate names, that contain values. The user decides which form to submit on. Only 1 form will be processed. Now my...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.