473,721 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

POST Method

FF
Hello

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

FF
Jul 17 '05 #1
9 81004
"FF" <fs@dd.pl> a écrit dans le message de news:
d4**********@ne mesis.news.tpi. pl...
Hello

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

FF


Hi,
Unfortunately, I dont think it's possible.
Bye
Jul 17 '05 #2
FF wrote:
Hello

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


Hi,

I am not sure what you mean, but is this helping?

make URL (with Javascript or whatever)
xxx.php?name=FF &number=42
from xxx.php:

$passedName = $_GET["name"];
$passedNumber = $_GET["number"];

Is that what you want?

Regards,
Erwin Moller

Jul 17 '05 #3
Erwin Moller wrote:
FF wrote:
Hello

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


Hi,

I am not sure what you mean, but is this helping?

make URL (with Javascript or whatever)
xxx.php?name=FF &number=42
from xxx.php:

$passedName = $_GET["name"];
$passedNumber = $_GET["number"];

Or alternatively, with POST:

<form action="xxx.php " Method=:post">
<input type="text" name="name">
<input type="text" name="number">
<input type="submit">
</form>

and in xxx.php you retrieve them:

$passedName = $_POST["name"];
$passedNumber = $_POST["number"];
Regards,
Erwin Moller
Jul 17 '05 #4
*** FF wrote/escribió (Fri, 29 Apr 2005 08:37:07 +0200):
I would like send variable to php script from URL
using POST method. Is possible do it ?
( <a href="xxx.php"> )


You need an intermediate script so you can:

1) Read the value from $_GET array.
2) Perform an HTTP connecion using the POST method.

Check the curl chapter, it may be helpful.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #5
This has worked in the past for me:

<form action="page.ph p" method="post" name="myForm">
<input type="hidden" name="name" value="Mr NoName" />
<input type="hidden" name="number" value="52" />
<a href="#" onClick="myForm .submit(); return false;">Click Here</a>
</form>

All the form elements are hidden so it looks like your just clicking a
link, but be careful not to put any sensitive or private information
into the hidden fields as people can still see them when viewing the
page's source

Hope it helps

Jul 17 '05 #6
On 29/04/2005 12:52, co********@gmai l.com wrote:
This has worked in the past for me:
Perhaps for a loose definition of "work".

[snip]
<a href="#" onClick="myForm .submit(); return false;">Click Here</a>


If you must refer to a form, do it properly:

document.forms. myForm.submit() ;

However, the more important concern is of no client-side scripting
support. Navigation should never depend upon a script.

[snip]

The OP should consider if a POST request is really appropriate for the
task at hand. In other words, what's wrong with GET?

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #7
Michael Winter wrote:
If you must refer to a form, do it properly:

document.forms. myForm.submit() ;

However, the more important concern is of no client-side scripting
support. Navigation should never depend upon a script.


And, if you're going to make absolute statements, you should do *that*
properly. Pedanticism is a 2 way street.

Navigation should never depend on a script where scripting engine
availability and compatibility can't be assured or the exclusion of
clients to whom the scripting functionality will be unavailable causes
undue harm.

Personally, I avoid absolute statements whenever I can, because I know
that my grasp of all possible scenarios is meager at best. And, absolute
statements, particularly those stating "rules" that aren't actually
scientific rules or laws tend to be based on a very specific set of
assumed criteria, which often don't match the questioner's situation.
This results in people following the "rules" to the detriment of their
project because they don't understand the reasoning behind the rules.

For instance, your rule against scripting is based on these assumptions:

1. Publicly accessible site with a "normal" distribution of browsers
including the most recent versions of Mozilla and IE as well as older
versions and more obscure browsers.
2. That a certain number of the viewers will have scripting either
completely incompatible or disabled.
3. That it is a "site" in the first place.

Not all of these things is true for every project. Seriously. I've built
PHP/Javascript applications that aren't accessed through a regular
browser at all. Rather, a customized wrapper around IE is used to launch
the app in fullscreen kiosk mode and is required to send the MAC address
of the ethernet adapter to be allowed into the app. In this case, there
was 100% IE and 100% Javascript compatibility/enabled. I could also
assume 1024x768 as all of the client setups were identical and imaged
from the same disk image. If I'd wasted time avoiding IE-specific
scripting or worked at all on cross-browser setup, I'd have been wasting
my client's money. The project would have suffered for blindly following
the rules.

So, what's the closest thing I use to a rule in regard to these kinds of
solutions? Figure out your userbase and make sure that *they* can use
it, whoever "they" are and quit clinging to absolute rules.

Remember, when someone asks how to do something, they may have a very
different purpose (an entirely reasonable purpose) in mind for the
technology. Just because you can't imagine a scenario that's
appropriate, don't assume one doesn't exist. Use the right tools for the
job.
Jul 17 '05 #8
On 29/04/2005 15:43, J Wynia wrote:
Michael Winter wrote:
[...] the more important concern is of no client-side scripting
support. Navigation should never depend upon a script.
[...] Pedanticism is a 2 way street.


To be pedantic, one must must be debating something irrelevant. I don't
think that challenging a course of action that may be unreliable would
fall under that category.
Navigation should never depend on a script where scripting engine
availability and compatibility can't be assured or the exclusion of
clients to whom the scripting functionality will be unavailable causes
undue harm.
I cannot argue that a statement along these lines would have been
better. However, I feel the important point is that an objection - well
phrased or not - has been raised.

Readers besides the OP may consider the answers in this thread and, even
if the solution is appropriate for the OP, it may not be for others. In
my experience, the misuse of client-side scripting occurs more often
than the avoidance of a scripted solution when it is appropriate.

[snip]
1. Publicly accessible site with a "normal" distribution of browsers
including the most recent versions of Mozilla and IE as well as older
versions and more obscure browsers.
2. That a certain number of the viewers will have scripting either
completely incompatible or disabled.
3. That it is a "site" in the first place.

Not all of these things is true for every project.


I am well aware of that, but I am used to the tendency of the Web being
the norm[1]. Perhaps that is not the case for this group. Are the
assumptions, without any other indication, so unreasonable? If not, and
the OP does have specific requirements or conditions, I would think it
sensible to mention them.

[snip]

Mike
[1] The specific circumstances may be irrelevant for many questions
to this group, but that is not usually the case once focus shifts
client-side.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #9

FF wrote:
Hello

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

FF


I have been meaning to write this one...
---------------------------------------

Q. How do I post a form to another site?
A. Use stream_context_ create() to create a HTTP POST context, then open
a connection to the site in question with fopen(), passing the context
as the fourth parameter. Use fread() to read the result from the form
submission.

Example:

$post_vars = array(
'post_var1' => "hello",
'post_var2' => "world"
);

// build the request body
foreach($post_v ars as $name => $val) {
$pairs[] = $name . '=' . rawurlencode($v al);
}
$body = implode("&", $pairs);

// HTTP options
$opts = array(
'http'=>array(
'method'=>"POST ",
'header'=>"Cont ent-type: application/x-www-form-urlencoded\r\n" .
"Content-length: " . strlen($body) . "\r\n" .
"Cookie: foo=bar\r\n",
'content'=>$bod y
)
);

$context = stream_context_ create($opts);

$f = fopen('http://localhost/test.php', 'r', false, $context);
In PHP 5, a context can also be passed to file_get_conten ts() and
file().

Although stream_context_ create() is available since PHP 4.3.0, support
for HTTP POST has only become available in 4.3.5. If you are using an
older version, you would need the cURL functions or use fsockopen() to
open the connection and send the request with fputs().

[cURL example here]

Jul 17 '05 #10

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

Similar topics

0
2464
by: Spud | last post by:
<?php // pullpage function by Nick bouton http://www.nickbouton.com/. $CustomerID = "IDHERE"; $method = "POST"; $host = "xml.mydata.com"; $usepath = "/xml.asp"; //print all vars in an array
7
20926
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open the asp page. When I use _blank target there is no problem, either I use GET or POST method. But when I use _search target, only GET method works.
15
3127
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. When I find is that if I send the value by the GET method, response.write("From QueryString: " & Request.QueryString("usernamefromform") & "<br><br>")
2
1923
by: Asp Help | last post by:
I'm working on a ASP applicatition to create Windows 2000 users. Because I don't want everybody to have access to the site I've changed te security in IIS 5.0 which runs on a windows 2000 Sp4 server: The security on the site is mainly anonymous. The anonymous account has been changed to an account which has the right permissions. The security on one asp page (GetUser.asp) is changed to only "Windows Integrated". A User that access the...
2
3275
by: Keith Selbee | last post by:
I am trying to submit data to a webpage in the form of a post and my code is below. It is a function that takes a url and the post content as strings and then performs the post. But as soon as I add the post data to the headers I get an exception that just says "headers". Can anyone please help me here? Thanks.... public string Get(string u, string c) { WebRequest wr = WebRequest.Create(u); wr.Headers.Add(c);
5
17387
by: Tammy | last post by:
Hi, I have an aspx app which needs to post data to a form and read the response. I am confused on whether I should be using the get_url using "POST" method or the post_url using "GET" method. string get_url = "http://scmvs4:9090/gtccinfo/H485W020.HTML"; --url contains a form string post_url = "http://scmvs4:9090/cgi-bin/gticglnk/P485VEGA"; --called by get_Url upon submit
7
4258
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant" value="Merchant Name"> <input type="hidden" name="OrderID" value="Unique OrderID value"> <input type="hidden" name="email" value="Customers email address (OPTIONAL)">
24
2880
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 image below it.
56
7228
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my website. The issue is that I need to gauge whether a user has any items in their basket to decide which page I redirect them too. I could
8
2397
by: Kurda Yon | last post by:
Hi, I have to decide which form-method I should use (GET or POST). I found the following recomendation: If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. (http://www.cs.tut.fi/~jkorpela/ forms/methods.html). However, later I did not find any convinced arguments why it should
0
8730
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,...
0
9215
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9131
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
9064
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
8007
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
6669
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
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
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
3
2130
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.