How can I execute a PHP function in a form action?

Posted by stocksy101 on Stack Overflow See other posts from Stack Overflow or by stocksy101
Published on 2009-02-27T16:01:59Z Indexed on 2010/04/22 1:43 UTC
Read the original article Hit count: 173

Filed under:
|

I am trying to run a function from a PHP script in the form action.

My code:

<?php
require_once ( 'username.php' );

echo '
<form name="form1" method="post" action="username()">
  <p>
    <label>
      <input type="text" name="textfield" id="textfield">
    </label>
  </p>
  <p>
    <label>
      <input type="submit" name="button" id="button" value="Submit">
    </label>
  </p>
</form>';
?>

I echo the form but I want the function "username" which is called from username.php to be executed. how can I do this in a simliar way to the above?

© Stack Overflow or respective owner

Related posts about php

Related posts about beginner