geroido Posted September 10, 2008 Share Posted September 10, 2008 Hi Can anyone tell me how to get the 'name' of a submit button. On the next page I want to retrieve whether the user chose 'user' or 'client'. The form method is post. <TR> <TD><input type="submit" name="user" value="General user"></TD> <TD> <input type="submit" name="client" value="Register as a client"></TD></TR></table> Quote Link to comment https://forums.phpfreaks.com/topic/123586-post-a-submit-button-values/ Share on other sites More sharing options...
JonnoTheDev Posted September 10, 2008 Share Posted September 10, 2008 $_POST['client']; or $_POST['user']; Quote Link to comment https://forums.phpfreaks.com/topic/123586-post-a-submit-button-values/#findComment-638211 Share on other sites More sharing options...
geroido Posted September 10, 2008 Author Share Posted September 10, 2008 Sorry Neil I want to post the value and assign it to a session variable. How can I do that? Quote Link to comment https://forums.phpfreaks.com/topic/123586-post-a-submit-button-values/#findComment-638212 Share on other sites More sharing options...
r-it Posted September 10, 2008 Share Posted September 10, 2008 why don't you have the same name for the submit buttons and just have different values and then you can retrieve the value via post, that's the only way i see it Quote Link to comment https://forums.phpfreaks.com/topic/123586-post-a-submit-button-values/#findComment-638221 Share on other sites More sharing options...
JonnoTheDev Posted September 10, 2008 Share Posted September 10, 2008 $_SESSION['varibleName'] = $_POST['variableName']; replace variableName for whatever post value you want in your session and remember to include session_start() at the top of every file using sessions. Quote Link to comment https://forums.phpfreaks.com/topic/123586-post-a-submit-button-values/#findComment-638224 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.