Jump to content

[SOLVED] echo record inside text box (easy one)


emediastudios

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

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.