Submit Form to 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
Junk Guy
Forum Newbie
Posts: 9
Joined: Thu Jun 20, 2002 11:55 am

Submit Form to PHP Function

Post by Junk Guy »

Is there any way to submit a form to a PHP function rather than a page?

IE -
<FORM METHOD="POST" NAME="TESTFORM" ACTION="<? submitdata; ?>">

Thanks.
Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Post by Galahad »

I'm pretty sure this is not possible because php is all server side. The browser (which posts the data) does not have access to php functions.
Last edited by Galahad on Thu Jun 27, 2002 3:23 pm, edited 1 time in total.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Galahad is right, PHP is server-side therefore you cannot access PHP functions (user defined or built in) without posting data to the server, refreshing the page or going to a new page. What you can do is submit the page to itself (look into $_SERVER['PHP_SELF']) and then have an if loop to check if the page has been submitted in order to run the code to validate the info or whatever. If you want pop-up boxes and such with warnings you need to use javascript which is client side.

So the answer to your question is no. Oh and please read this... (note point 2)

Mac
Post Reply