xjermx Posted July 13, 2010 Share Posted July 13, 2010 I have a page with some buttons on it, currently using html <submit> that I am using to link to another PHP page. I am interested in having a set of functions represented on page 1 by buttons. In this case, something like "Create a new message", "Read messages for me", "View messages that I have sent". I want each of these functions to be supported on page 2. I'm aware that I can likely do this with functions and switch or if statements, but my question is this: What is the best case recommendation for implementing the buttons on page 1 and then getting the $whichaction variable or value over to page 2 so that page knows which function to execute? Quote Link to comment Share on other sites More sharing options...
Glenugie Posted July 13, 2010 Share Posted July 13, 2010 Well, you could either hand the $_POST value into a session variable and have it redirect you to the next page, and have that page take action depending on the session variable. Or, you could just use a $_GET variable set to the $_POST value. Hope this helps Quote Link to comment Share on other sites More sharing options...
gwolgamott Posted July 13, 2010 Share Posted July 13, 2010 <input type="submit" name="calculate" value="add"> <input type="submit" name="calculate" value="subtract"> <input type="submit" name="calculate" value="multiply"> My favorite method is something like this... same name and type but different values. Then just check the isset() for calculate and if it exists check its value then do whatever based on the value. EDIT: Good reference: http://articles.techrepublic.com.com/5100-10878_11-5242116.html Quote Link to comment 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.