angerbeaver Posted January 2, 2008 Share Posted January 2, 2008 Hi, I looked around the tutorials but didn't see anything (if I missed it, a link would be great;)) on how to split html/php code cleanly. The way I started to do it seemed good to me then I sat back and looked at my method and found it odd. This is how I was doing it: this was my include file: <? /* func.php */ function web_reg() { echo ' <form name"frmRegister" action="./" method="POST"> <table border="0"> <tr><td>Name:</td><td><input type="text" name="username" value=""></td></tr> <tr><td><input type="submit" value="Go"></d></tr> </table> <input type="hidden" name="action" value="register"> </form>'; } and the calling file /* index.php */ <html> <head><title></title> <?php include('../func.php'); ?> </head> <body> <?php if(isset($_REQUEST['action'])) { if($_POST['action'] == "register") { /* register validation and user creation */ } else { web_reg(); //Call to display the HTML } } ?> </body> </html> So I'm just wondering if using my index.php and calling a file to display the HTML is a weird/bad way of doing things. Quote Link to comment https://forums.phpfreaks.com/topic/84195-split-htmlphp/ Share on other sites More sharing options...
revraz Posted January 2, 2008 Share Posted January 2, 2008 What ever is easiest for you to work with is the best way. Quote Link to comment https://forums.phpfreaks.com/topic/84195-split-htmlphp/#findComment-428714 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.