Page 1 of 1

<form> post to specific PHP function

Posted: Fri Sep 15, 2006 2:15 am
by sunbin
Hi I attempted to post the info on form.php to a (create) function in process.php

Code: Select all

<form action="process.php" method="post" onsubmit="create()">
 .... ....
</form>
but don't seems work, guess the method I thought of don't seems to work... May I know how shd i do it?


along with the above question

and also if i want to set a $_Session['variable'] when upon clicking SUBMIT button. How shd i do it?

Posted: Fri Sep 15, 2006 3:03 am
by aaronhall
It looks like you're confusing PHP with Javascript. onClick is a Javascript event. With your form as it is, it's trying to call a javascript function called create() when you click the submit button.

This script demonstrates a simple form submission using PHP. Also check out http://us2.php.net/manual/en/tutorial.forms.php.