<form> post to specific PHP function

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
sunbin
Forum Newbie
Posts: 2
Joined: Wed Sep 13, 2006 10:17 pm

<form> post to specific PHP function

Post 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?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
Post Reply