On 2/11/2011 9:23 PM, Ashim Kapoor wrote:
Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

Many thanks,
Ashim.



But basically, the short of it is this.

<form action="/process.php?page_id=22&action=AddUser" method="POST">
  <input type="hidden" name="action" value="DelUser" />
  <table width="100%">
    <tbody>
      <tr>
        <td align="right" width="40%">
          Name:</td>
        <td width="60%">
          <input name="FullName" type="text" /></td>
      </tr>
      <tr>
        <td align="center" colspan="2">
          <input type="submit" value="Submit Form" />
          <input type="reset" value="Reset Form" /></td>
      </tr>
    </tbody>
  </table>
</form>

When submitted with data to this:

<?php

# filename:process.php

print_r($_GET);
print_r($_POST);
print_r($_REQUEST);

?>

Will result in this:

Array
(
    [page_id] => 22
    [action] => AddUser
)
Array
(
    [action] => DelUser
    [FullName] => Jim Lucas
)
Array
(
    [page_id] => 22
    [action] => DelUser
    [FullName] => Jim Lucas
)

Check out the example that I wrote here http://www.cmsws.com/?page_id=5

Jim Lucas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to