Page 1 of 1

Is it possible to have both get and post in one page?

Posted: Fri Sep 17, 2004 12:31 pm
by ljCharlie
I have a page that I have

Code: Select all

<? echo '<a href=$self?imageID=$picID&sectionID=$sectID class='submenu'>Home Pic</a>';?>
as a link and this by default is a get method. Now on the same page I have a form that I used the post method. On the result page, can I receive both post and get method? The link and the form button also goes to the same page carying different variable values. And according to which value the page passed, the result will display certain data or picture from the MySQL database. But it seemed that I can not retrieve both get and post variable value from the previous page. Is this possible?

ljCharlie

Posted: Fri Sep 17, 2004 12:33 pm
by markl999

Posted: Fri Sep 17, 2004 2:15 pm
by timvw
try

<form action="?foo=bar" method="post">
<input type="text" name="foo2" value="bar2" />
<input type="submit" />
</form>

<?php
echo "post"; print_r($_POST); echo "<br>";
echo "get"; print_r($_GET); echo "<br>";
echo "request"; print_r($_REQUEST); echo "<br>";
?>