Jump to content

PHP inside a MySQL entry


MCrosbie

Recommended Posts

Hi there,

I have PHP in a MySQL entry. I am wanting to spit this out again however the echo function somehow turns the PHP code into html and the PHP is not processed. Can you think of anyway to make it spit out the MySQL entry and run the PHP code that is inside it?

Yours Sincerely,

Michael
Link to comment
Share on other sites

I have got the below code in the database. Why isn't the <script ...> tags working?

[code]<?PHP echo '
<form action="back.php?functid='.$_GET['functid'].'" method="post" enctype="multipart/form-data" name="FormID'.$_GET['functid'].'">
<div id="xToolbar"></div>
<p>Name of page 
  <input type="text" name="title" />
  <br />
  Status <br />
<label name="statuslive"><input name="status" type="radio" value="0" /> Live to the public</label><br />
<label name="statusdevelopment"><input name="status" type="radio" value="1" /> Under development</label><br />
  Place your page on the tree:<br />
<script type="text/javascript">
<!--
tree = new treemenu(\'tree\', true, true, true, false);
tree.put(1,\'<input type="radio" name="type" value="1"><a> Add page here </a>\',\'_self\',\'\',\'Add page here\',\'\',\'\'); // For use with a form';
$var['spacing'] = "";
$var['level'] = 1;
findView($_GET['functid']);
if(isset($var['viewID'])){
$var['link'] = "front.php?functid=".$var['viewID']."&id={id}"; }
PTLevels($var['link'],'form'); // If you don’t want it for a form replace ‘form’ with ‘’.
echo '
  document.write(tree);
//-->
</script>
  <br />
  Page Description';
$oFCKeditor = new FCKeditor( 'description' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;
echo '<br />
Contents of page<br />
';
$oFCKeditor = new FCKeditor( 'content' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;

echo '
<br />
Template
<select name="template">
';
connectdb('');
$res['templates'] = mysql_query("Select * from DM_templates");
while($row['templates'] = mysql_fetch_array($res['templates'])){
echo '
<option value="'.$row['templates']['id'].'">'.$row['templates']['title'].'</option>
'; }
echo '
</select><br />
Permissions<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr class="table_header">
                                <td width="100">Permission</td>
                                <td>Username</td>
                              </tr>
  ';
  $var['changestyle'] = 2;
$i = 0;
$res['permissions'] = mysql_query("Select * from DM_users where userlevel < '3'");
while($row['permissions'] = mysql_fetch_array($res['permissions'])){
print("<tr ".(!($i%$changestyle)?"class='table_alternative'\"":"").
            '><td><input name="permissions[]" type="checkbox" id="permissions[]" value="'.$row['permissions']['id'].'" /></td><td>'.$row['permissions']['username'].'</td></tr>');
$i = $i+ 1;
} echo '
          </table>
  <input name="permissionscount" id="permissionscount" type="hidden" value="'.mysql_num_rows($res['permissions']).'" />
</p><br />
<div id="form_submit" align="right">
      <A HREF="javascript:document.FormID'.$_GET['functid'].'.reset()"><img name="Reset" type="image" id="Reset" alt="Cancel" border="0" src="../images/form_bcancel.png" /></a>
        <input name="Submit" type="image" id="Submit" src="../images/form_bnext.png" />
      </div></form>';
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.