czukoman20 Posted November 25, 2007 Share Posted November 25, 2007 here is my coding <? if($session->isPrem()){ <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Single File Upload </strong></td> </tr> <tr> <td>Select file <input name="ufile" type="file" id="ufile" size="50" /></td> </tr> <tr> <td align="center"><input type="submit" name="Submit" value="Upload" /></td> </tr> </table> </td> </form> </tr> </table> } else{ echo "You must be loggied in to view this information. If you do not have a premium account, then you will not be able to view this page." } ?> My issue is, that i cant use html inside of a php area. Is there a way to make this if statement mixed to where i can have a php if and html code. Or is there a way i can remake this code differently. help is appreciated thanx Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/ Share on other sites More sharing options...
Crew-Portal Posted November 25, 2007 Share Posted November 25, 2007 <?php if($session->isPrem()){ echo " <table width='500' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#CCCCCC'> <tr> <form action='upload_ac.php' method='post' enctype='multipart/form-data' name='form1' id='form1'> <td> <table width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#FFFFFF'> <tr> <td><strong>Single File Upload </strong></td> </tr> <tr> <td>Select file <input name='ufile' type='file' id='ufile' size='50' /></td> </tr> <tr> <td align='center'><input type='submit' name='Submit' value='Upload' /></td> </tr> </table> </td> </form> </tr> </table> "; } else{ echo "You must be loggied in to view this information. If you do not have a premium account, then you will not be able to view this page."; } // It wont pass validation thought for XHtml Translate... ?> Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398935 Share on other sites More sharing options...
Lumio Posted November 25, 2007 Share Posted November 25, 2007 If you really want to mix PHP and HTML use PHP-Blocks <?php //your code here ?> <b>some text</b> <?php //more php if (isset($_GET['page'])) { ?> <i>only show me, when ?page is set</i> <?php }else { ?> <a href="?page">Click here to show something invisible</a> <?php } ?> But better use templates. Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398940 Share on other sites More sharing options...
revraz Posted November 25, 2007 Share Posted November 25, 2007 I do it Lumio's way as well, because I hate to echo all that HTML and worry about inserting variables within the HTML along with quotes. Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398943 Share on other sites More sharing options...
czukoman20 Posted November 25, 2007 Author Share Posted November 25, 2007 Well im not sure if i understand lumio's way. Could u possibly give me an example using the code i gave. If you dont want to it would be ok, but i'd appreciate it Also when i do 530's way, it wont upload anything, which has to do to the fact that its actually being echoed, so its useless. Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398947 Share on other sites More sharing options...
Lumio Posted November 26, 2007 Share Posted November 26, 2007 Your wish is my command: <?php if($session->isPrem()){ ?> <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Single File Upload </strong></td> </tr> <tr> <td>Select file <input name="ufile" type="file" id="ufile" size="50" /></td> </tr> <tr> <td align="center"><input type="submit" name="Submit" value="Upload" /></td> </tr> </table> </td> </form> </tr> </table> <?php } else{ echo "You must be loggied in to view this information. If you do not have a premium account, then you will not be able to view this page." } ?> Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-399362 Share on other sites More sharing options...
revraz Posted November 26, 2007 Share Posted November 26, 2007 Can we wish for women and beer too? Your wish is my command: Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-399415 Share on other sites More sharing options...
Lumio Posted November 27, 2007 Share Posted November 27, 2007 For sure Quote Link to comment https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-400101 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.