form/function question

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
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

form/function question

Post by cto1mac »

I am trying to streamline my site. I have a form, when it is submitted it calls another page and that page writes the information to my db. How can I set the form up to send those values to a function that will handle the db write. I am trying to put the function in the page, so that I can eliminate the middle man.

Thanks
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

have the first page call itself and at the top check to see if the one of the values in the form isset()
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

Code: Select all

function db_write($data) {
    // write to db
}


if (isSet($_POST['foo'])) {
    db_write($_POST['foo']);
}
Post Reply