emediastudios Posted December 17, 2008 Share Posted December 17, 2008 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."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/ Share on other sites More sharing options...
5kyy8lu3 Posted December 17, 2008 Share Posted December 17, 2008 Hey everyone, still a newbe, but should of worked this out, I got this code on top of my file does this work? <textarea name="history" cols="60" rows="12" class="fields" id="history" value="<?php echo $history; ?>"></textarea> Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/#findComment-717571 Share on other sites More sharing options...
dokueki@gmail.com Posted December 17, 2008 Share Posted December 17, 2008 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."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/#findComment-717573 Share on other sites More sharing options...
emediastudios Posted December 17, 2008 Author Share Posted December 17, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/#findComment-717579 Share on other sites More sharing options...
dokueki@gmail.com Posted December 17, 2008 Share Posted December 17, 2008 Replace <?php echo $history; ?> with '.$history.' (Including quotes and everything) Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/#findComment-717586 Share on other sites More sharing options...
emediastudios Posted December 17, 2008 Author Share Posted December 17, 2008 Thanks mate Works a charm, thanks Quote Link to comment https://forums.phpfreaks.com/topic/137343-solved-echo-record-inside-text-box-easy-one/#findComment-717598 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.