Use Javascript input for PHP Script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
melbell
Forum Newbie
Posts: 1
Joined: Wed Oct 01, 2003 1:45 am

Use Javascript input for PHP Script

Post by melbell »

If I have this javascript code:

var name = prompt("What is your name", "Type you name here");

Is there any way that I can use that input in a php script?
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

Yes.

Code: Select all

var name = prompt("s...."," ");
window.location = '/path/to/your/script.php?name=' + name;
Or just put this value to a form field and submit to your script.
[xNet]DrDre
Forum Newbie
Posts: 8
Joined: Wed Oct 01, 2003 7:06 am

Post by [xNet]DrDre »

exactly.

while the GET method is easier to do, this can lead to bombing of scripts if any kind of logging is involved
Post Reply