$_POST via href?

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
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

$_POST via href?

Post by psurrena »

Is it possible to not use a form button with $_POST but instead just a text link?
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

Not possible in any easy wasy that I know of, unless using $_GET is an option;

Code: Select all

<a href="page.php?input=value+of+input">page.php</a>
page.php:

Code: Select all

<?php
echo $_GET['input']; // Outputs value of the URL-variable called 'input' (value+of+input in this case)
?>
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

JavaScript can do it. Look into document.form.submit().
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

EDIT | Answer removed because I was stupid and did not read the original post correctly.

Use Javascript.
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

Post by psurrena »

errr...not what I wanted to hear :?

Time to buy a book I guess.
Post Reply