How to call a php function, when i click submit?

Hello.I have a problem calling php function when i click submit button:

[php]else {
if(isset($_GET[‘submit’])) {
friend_request();
header('Location: '.$profile_user_id);
exit();
}
}
}
}
?>


[/php]

Here’s function:

[php]function friend_request() {
if (isset($_POST[‘submit’])) {
if (isset($_GET[‘username’]) === true and empty($_GET[‘username’]) === false) {
$username = $_GET[‘username’];

if(user_exists($username) === true) {
$profile_user_id		= user_id_from_username($username, 'username');
$my_id					= $_SESSION['user_id'];
$profile_data			= user_data($profile_user_id, 'username', 'first_name', 'last_name', 'email', 'profile');

mysql_query("INSERT INTO friend_request VALUES('', '$my_id', '$profile_user_id')");

}
}
}
}[/php]

It refreshes the page,but doesnt send the query. Please help me. Thanks!

You need to name the submit button for it to have a name server side ($_GET[‘name’] = value)

Sponsor our Newsletter | Privacy Policy | Terms of Service