php-beginner Posted February 9, 2011 Share Posted February 9, 2011 Hello everyone, Can someone show me a way how to pass $_post variable from a form to a function? So, input username and input password to a function login($username, $password). Link to comment https://forums.phpfreaks.com/topic/227182-pass-_post-variables-to-function/ Share on other sites More sharing options...
BlueSkyIS Posted February 9, 2011 Share Posted February 9, 2011 something like... <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { $username = isset($_POST['username'])?$_POST['username']:''; $password = isset($_POST['password'])?$_POST['password']:''; $return_val = login($username,$password); } ?> Link to comment https://forums.phpfreaks.com/topic/227182-pass-_post-variables-to-function/#findComment-1171912 Share on other sites More sharing options...
php-beginner Posted February 9, 2011 Author Share Posted February 9, 2011 That is exactly what i need. Thankyou very much! Link to comment https://forums.phpfreaks.com/topic/227182-pass-_post-variables-to-function/#findComment-1171928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.