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> 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']; 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? 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 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. 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
Archived
This topic is now archived and is closed to further replies.