ferrins Posted September 12, 2006 Share Posted September 12, 2006 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"></form>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!Thnkx!(and my register_globas is on) Quote Link to comment https://forums.phpfreaks.com/topic/20537-sending-form-data-to-an-external-function/ Share on other sites More sharing options...
HuggieBear Posted September 12, 2006 Share Posted September 12, 2006 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.[code]<?php include_once('functions.php'); $group = $_GET['group']; checkgroup($group);?>[/code]RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20537-sending-form-data-to-an-external-function/#findComment-90594 Share on other sites More sharing options...
leeish Posted September 12, 2006 Share Posted September 12, 2006 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'];checkgroup($var)}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 Quote Link to comment https://forums.phpfreaks.com/topic/20537-sending-form-data-to-an-external-function/#findComment-90596 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.