Jump to content

PHP and HTML...... mixed?


czukoman20

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/
Share on other sites

<?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...
?>

Link to comment
https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398935
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398940
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-398947
Share on other sites

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."
}
?>

Link to comment
https://forums.phpfreaks.com/topic/78829-php-and-html-mixed/#findComment-399362
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.