473,796 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About "posting" forms


Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?

<form action="https://www.mysite.com/cgi/incoming.php" method="post">
<input type="hidden" name="data01" value="12">
<input type="hidden" name="data02" value="rejected ">
<input type="hidden" name="star" value="sirius">
<input type="image" src="https://www.mysite.com/grid001/image1.gif"
border="0" name="submit" alt="send data">
</form>

What I would like to do is make the use of this form as invisible to the
user as possible by

1. getting rid of the image (but then how do I "post" it)
2. putting PHP variables into the value fields
3. send the form

The PHP variables are set up as in
$data01 = 12;
$data02 = 'rejected'
etc
then

after just including it as in "include_once(' senddata.php'); the form
above is in senddata.php and just gets posted

I've been looking at this and can't see how without having to include the
form on a html page. I looked at document.write but that again is
javascript.

Can this be done with just PHP?

thanks

tony
Jun 7 '06 #1
6 1661
to**@tony.com wrote:
Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?

<form action="https://www.mysite.com/cgi/incoming.php" method="post">
<input type="hidden" name="data01" value="12">
<input type="hidden" name="data02" value="rejected ">
<input type="hidden" name="star" value="sirius">
<input type="image" src="https://www.mysite.com/grid001/image1.gif"
border="0" name="submit" alt="send data">
</form>

What I would like to do is make the use of this form as invisible to the
user as possible by

1. getting rid of the image (but then how do I "post" it)
2. putting PHP variables into the value fields
3. send the form

The PHP variables are set up as in
$data01 = 12;
$data02 = 'rejected'
etc
then

after just including it as in "include_once(' senddata.php'); the form
above is in senddata.php and just gets posted

I've been looking at this and can't see how without having to include the
form on a html page. I looked at document.write but that again is
javascript.

Can this be done with just PHP?

thanks

tony


Tony,

A form is an html construct - so not being in an html page is meaningless.

Maybe if you tell us exactly what you're trying to accomplish we can give you
other ideas.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 7 '06 #2
to**@tony.com wrote:
Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?

<form action="https://www.mysite.com/cgi/incoming.php" method="post">
<input type="hidden" name="data01" value="12">
<input type="hidden" name="data02" value="rejected ">
<input type="hidden" name="star" value="sirius">
<input type="image" src="https://www.mysite.com/grid001/image1.gif"
border="0" name="submit" alt="send data">
</form>

What I would like to do is make the use of this form as invisible to
the user as possible by

1. getting rid of the image (but then how do I "post" it)
2. putting PHP variables into the value fields
3. send the form

The PHP variables are set up as in
$data01 = 12;
$data02 = 'rejected'
etc
then

after just including it as in "include_once(' senddata.php'); the form
above is in senddata.php and just gets posted

I've been looking at this and can't see how without having to include
the form on a html page. I looked at document.write but that again is
javascript.

Can this be done with just PHP?

thanks

tony


The POST method is used to send data from a web page to the server so that
you can use it in things like php variables.
You don't need an image or even a button to submit a form. A text input box
will work to submit a form just by pressing the enter key.
What you need to do is to explain what you ultimately want to happen.
Jun 7 '06 #3
Tom

<to**@tony.co m> wrote in message
news:MP******** *************** *@news-text.blueyonder .co.uk...

Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?


Unless I've failed to understand what you're after, you could use the CURL
library.
It allows you to call any web page (not necessarily a PHP page) from within
your PHP.
Make sure the "extension=php_ curl.dll" is uncommented in your PHP.ini.

Something like this (which uses buffering to stop the returned web page
being displayed)...
ob_start();
$ch = curl_init('http s://www.mysite.com/cgi/incoming.php');
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIE LDS, 'data01=12&data 02=rejected');
curl_exec($ch);
$getinfo_result s = curl_getinfo($c h);
curl_close( $ch );
$return_page = ob_get_contents ();
ob_end_clean();

"$getinfo_resul ts" will give an array of information telling you if the page
request was successful or not, and "$return_pa ge" will contain the full HTML
of the request.

Tom
Jun 7 '06 #4
In article <4e************ *@individual.ne t>, pa**********@bt internet.com
says...
to**@tony.com wrote:
Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?

<form action="https://www.mysite.com/cgi/incoming.php" method="post">
What you need to do is to explain what you ultimately want to happen.


I'm sorry I assumed you could see what I want to do by looking at the
form action I posted

I want to send the data to another web server as if it had been posted
using the forms post method without having the form appear in the source
of the clients web page.

Looking at it another way I want to "post" the data without using the
form but it MUST be using the "post" method because thats how the
reciever is set up and I cant control that.

I already have the data I just want to use the post method to send it
without the client getting it as well.

I hope that explains it - I can't think of a way to say it any clearer.

tony


Jun 8 '06 #5
In article <44************ ***********@ptn-nntp-reader01.plus.n et>,
to************* *@ETHISgmail.co m says...

<to**@tony.co m> wrote in message
news:MP******** *************** *@news-text.blueyonder .co.uk...

Is it possible to use the post method to send a form from PHP without
having to put the form in a html page?


Unless I've failed to understand what you're after, you could use the CURL
library.
It allows you to call any web page (not necessarily a PHP page) from within
your PHP.
Make sure the "extension=php_ curl.dll" is uncommented in your PHP.ini.

Something like this (which uses buffering to stop the returned web page
being displayed)...
ob_start();
$ch = curl_init('http s://www.mysite.com/cgi/incoming.php');
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIE LDS, 'data01=12&data 02=rejected');
curl_exec($ch);
$getinfo_result s = curl_getinfo($c h);
curl_close( $ch );
$return_page = ob_get_contents ();
ob_end_clean();

"$getinfo_resul ts" will give an array of information telling you if the page
request was successful or not, and "$return_pa ge" will contain the full HTML
of the request.

Tom


Hi Tom - I think you do get the idea (from your buffering comment)
I've never heard of curl (I'm just getting over wasting loads of my time
with that pear rubbish)

I'll take a look at curl (assuming my service provider allows its use -
these people are very daft about what they do and dont allow sometimes)

thanks for the idea

tony
Jun 8 '06 #6

It turns out that you can use the Post method to send data as if it came
from a form easy enough - no other libraries etc are needed.

Just create a php script that writes a "POST" header then url encode what
would have been the form items names and values as the body and then use
PHP's fsockopen to send the data.

The remote end thinks it came from a form which is exactly what I needed.

Hope this helps anyone reading this.

tony
Jun 12 '06 #7

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

Similar topics

2
1310
by: | last post by:
so i am using Dreamweaver; and I need to be able to have multiple pages post to a page called page6_1.asp from there; i give people the ability to either '1 - save definition as new report'; '2 - overwrite existing report definition'; or '3 - new draft for existing report' I have these 3 functions written as seperate pages.. Because Dreamweaver starts getting confused when you put too much on one page.
32
2695
by: Indrid Colt | last post by:
Thank's for your help ! Indrid
26
2529
by: Chris Potter | last post by:
Hello everyone. I am taking my first course in C and in one of my assignments i need to print out an array that could have anywhere from 0 to 100 positive integers in it (a negative integer is used to stop input), and i have to print 8 integers per line. The code that i have works, and does exactly that, but i feel a little uneasy because i am using two breaks. I would like to hear any comments about this approach, and what i might do to...
3
9407
by: C# Learner | last post by:
I'm working on an app which uses a background thread to read data from a socket. At the moment I'm doing something a bit "naughty" -- I'm firing an event after reading from the socket, and this event gets picked up by an event handler in the GUI thread, without "synchronizing" with this GUI thread. How can I "synchronize" threads in .NET?
7
1694
by: lintolawrance | last post by:
hello, i am a student trying to learn php.i have a doubt about a sentence written in the textbook.the sentence is "upload the file to your web server", for that what i have to done.
3
1637
by: jpa770 | last post by:
3 employee's will be responsible for installing and maintaining IBM product set to include but not limited to Tivoli Access Manager 6.0, IBM Websphere Application Server, IBM MQ Server, and IBM DB2 application. Send resume' : jpa770@bellsouth.net
7
1386
by: Abhinay | last post by:
hi, sorry for asking this question in this forum, but i did't found any contact of concern person. My que is still unanswered so i wanted to post a message to my thread as per Posting Guidelines, but i dont know how to post a messge to my thead. can any budy help me ???? thank
4
1476
by: webandwe | last post by:
Hi I have a field box that will be used for GPS co-ordinates. But the " and ' mess my mysql query up. My code work like this. $a1=$_POST; query = "INSERT INTO information VALUES ('','$a1','$a2',...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.