coolgamer48 Posted December 24, 2007 Share Posted December 24, 2007 Okay, so let's say we have a page called index.php, and we have two buttons - sign in, and register.Could we make it so that the sign in button directs you to index.php?action=sign_inand the register button directs you to index.php?action=registerand then based on the action variable we would do different things, like if ($_POST["action"] == "sign_in"){ include("sign_in.php");}else if ($_POST["action"] == "regster){ include("register.php");} would that work? Link to comment Share on other sites More sharing options...
boen_robot Posted December 24, 2007 Share Posted December 24, 2007 We could, but why not make links instead. It's easier and more starightforward.I mean it's just: <a href="?action=sign_in">Sign in</a><a href="?action=register">Register</a> And yes... what you plan will work (though I see a missing quote in the second if, but you've got the idea correctly already). Link to comment Share on other sites More sharing options...
coolgamer48 Posted December 24, 2007 Author Share Posted December 24, 2007 Since the pages are going to have all the same stuff except the main content, I just thought it would be easier for me to organize if I had the different content separated away from all the other stuff that I don't need to worry about.You're kind of right though, I modeled the rest of my site with just links, but I have a feeling that sending different variables is going to become more useful as I make things more complex. Link to comment Share on other sites More sharing options...
mc_keny Posted December 26, 2007 Share Posted December 26, 2007 YEAH ITS POSSIBLE ON MY index PAGE i have most of the features on it instead of having different different files i.e switch("$action"){case signin://sign in form break;case signup://sign up formbreak;case main://main pagebreak;case inbox://inbox menubreak;default://front pagehere you have the link to sign in page and sign up i.ehref=\"index.php?action=signinhref=\"index.php?action=signin}close switch() i use the switch statement to use less if statement cos at times we often misplace a brace so we having less if state ment thats less prob Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.