开发者

How to echo $row["Text'] to a TextField

开发者 https://www.devze.com 2023-01-20 16:31 出处:网络
Using PHP I am able to query MySQL database and see the results echo using: e开发者_如何学编程cho $row[\'Text\'];

Using PHP I am able to query MySQL database and see the results echo using:

e开发者_如何学编程cho $row['Text'];

I would like the information to load into TextField myAnswer instead. Can anyone help?

Thanks


Like this

<input type="text" name="myAnswer" value="<?php echo htmlspecialchars($row['Text']) ?>" />

or

<textarea name="myAnswer" rows="6" cols="40"><?php echo htmlspecialchars($row['Text']) ?></textarea>


None of this seems to work for me. Upon looking further, I found the following:

http://www.daniweb.com/forums/thread252486.html -- You can not manipulate text fields like java or C# or as3 but you can echo or print out html tags and text. if you echo your text you will need to space or manipulate using css and html.

So I guess I can't get the results back from the query in a textbox using PHP and MySQL.

Thanks anyways


Going on assumption from your question, you might try something like:

<input type="textbox" value="<?php echo $row['Text']; ?>" />

If you're thinking about a textarea control it'd be like this:

<textarea><?php echo $row['Text']; ?></textarea>


<input type="text" name="myAnswer" value="<?php echo $row['Text']; ?>" />


<?php if ($row['Text']) {?> 
<textarea><?php echo htmlspecialchars($row['Text']); ?></textarea>
<?php } ?>

if you are displaying in the same page, otherwise you can just leave out the if .. check.

0

精彩评论

暂无评论...
验证码 换一张
取 消