Jump to content

Recommended Posts

Hey everyone, still a newbe, but should of worked this out,

I got this code on top of my file

 <?php
include_once('includes/include.php');
$query = "SELECT * FROM history where id =1";
$result = mysql_query($query) or die(mysql_error());
while($news=mysql_fetch_array($result)){

$history .= "$news[history]";

}

?>

and i want to add the varible to show in the text box so i can see all the text, make my changes then hit update.

I tried many versions of the below  code but it dont work.

<?php
if($secret == "89"){ 
$content .='
<form id="news" form action="history_edit.php" method="post">
  <table width="500" border="0">
    <tr>
      <td colspan="2" class="orangelink"><strong>Update History</strong></td>
    </tr>
    <tr>
      <td width="108">Text</td>
      <td width="182"><label>
        <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo"$history"; ?></textarea>
      </label></td>
    </tr>
    <tr>
      <td colspan="2"><label>
        <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
      </label></td>
    </tr>
</table>
</form>
';
}
else $content .= "You Must Be Logged In To Do That.";
?>


 

Also, looks like you forgot to add the single quote at start, correct me if I'm wrong,

<?php
if($secret == "89"){ 
$content .= '
<form id="news" form action="history_edit.php" method="post">
  <table width="500" border="0">
    <tr>
      <td colspan="2" class="orangelink"><strong>Update History</strong></td>
    </tr>
    <tr>
      <td width="108">Text</td>
      <td width="182"><label>
        <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo $history; ?></textarea>
      </label></td>
    </tr>
    <tr>
      <td colspan="2"><label>
        <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
      </label></td>
    </tr>
</table>
</form>
';
}
else $content .= "You Must Be Logged In To Do That.";
?>

Also, looks like you forgot to add the single quote at start, correct me if I'm wrong,

<?php
if($secret == "89"){ 
$content .= '
<form id="news" form action="history_edit.php" method="post">
  <table width="500" border="0">
    <tr>
      <td colspan="2" class="orangelink"><strong>Update History</strong></td>
    </tr>
    <tr>
      <td width="108">Text</td>
      <td width="182"><label>
        <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo $history; ?></textarea>
      </label></td>
    </tr>
    <tr>
      <td colspan="2"><label>
        <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
      </label></td>
    </tr>
</table>
</form>
';
}
else $content .= "You Must Be Logged In To Do That.";
?>

 

Also, looks like you forgot to add the single quote at start, correct me if I'm wrong,

<?php
if($secret == "89"){ 
$content .= '
<form id="news" form action="history_edit.php" method="post">
  <table width="500" border="0">
    <tr>
      <td colspan="2" class="orangelink"><strong>Update History</strong></td>
    </tr>
    <tr>
      <td width="108">Text</td>
      <td width="182"><label>
        <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo $history; ?></textarea>
      </label></td>
    </tr>
    <tr>
      <td colspan="2"><label>
        <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
      </label></td>
    </tr>
</table>
</form>
';
}
else $content .= "You Must Be Logged In To Do That.";
?>

I missed the quote in the cut and paste, buts it in my file, the code didnt work.my code just showed <?php echo $history; ?> in the text box, the code you supplied me with displays and empty text box

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.