Jump to content


sending form data to an external function

  • Please log in to reply
2 replies to this topic

#1 ferrins

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 September 2006 - 06:25 PM

Hi everybody!
I'm trying to send some form data to a different page where I have all my site's functions.
My form page it's like this:

<form  method="post" action="functions.php?action=checkgroup"> /* is this action right? */
Group Name: <input type="text" name="group">
<input  type="submit" name="submit" value="check">

Then, in my functions.php page:

function checkgroup(whattheheckshouldIputinhere?){

sql stuff...

return something..


Well , so what am I missing? is it something related to GET action and stuff?
If anybody can give me a hand I'd appreciate it!
(and my register_globas is on)

#2 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 12 September 2006 - 06:29 PM

Almost there...

Probably best to have your functions page as just that, nothing else.  Then include it in the rest of your pages.  So your form calls validate.php which looks a little like this.

   $group = $_GET['group'];

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 leeish

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 12 September 2006 - 06:36 PM

The way we do it on my server is we have an index.php page which runs all of our Posts.  As HuggieBear said you need to include your functions page with in the other pages.  Then have your form Post to your index.php.  On you index.php have something like this...

if (isset$_POST['submit']){
$var = $_POST['submit'];

On your page of functions you should have your check group function look something like this...

function checkgroup($group){

ALL THE CODE YOU WANT...  $group now equals $var from above.


I hope I explained it well.  Good Luck

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users