[Javascript] POST a single value from a prompt

Dave Shaw dshaw256 at earthlink.net
Mon May 5 17:20:21 CDT 2008


I'm replying to the digest; I hope this doesn't duplicate another
response.

If you specifically want to use POST rather than GET, I'm not sure how
to do that directly. I did an end-around once via a hidden form but I
thought it was ugly.

If you want to use GET, the basics are fairly simple:

function myFunction() {
    var myString="This is the data value I want to send to PHP";
    document.location="myprogram.php?value="+myString;
}

myprogram.php would retrieve the value using "$value=$_GET['value']";

Hope this helps.

Dave Shaw


> > From: Mark Kelly <javascript at wastedtimes.net>
> > Reply-To: JavaScript List <javascript at lists.evolt.org>
> > To: javascript at lists.evolt.org
> > Subject: [Javascript] POST a single value from a prompt
> > Date: Sun, 4 May 2008 23:02:56 +0100
> > 
> > 
> > Hi.
> > 
> > Beginners question: How do I accept a text string through a 
> > javascript 'prompt' dialog then immediately POST it to a php file?
> > 
> > I realise this must be pretty basic, but I don't know the right phrase to 
> > google for, apparently :/
> > 
> > Thanks,
> > 
> > Mark
> > 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20080505/0732a5f3/attachment.htm>


More information about the Javascript mailing list