|
Posted by Jeff Brady on 10/13/22 11:46
I have a pretty simple mysql db, and have no problems echoing the data
via php.
My problem is with trying to print the data to a textarea (on a form, so
the data can be edited)
My form is pretty simple .. text box for field1, textbox for field2, and
a textarea for field3 (because field3 can contain a few paragraphs of text)
the main part of the page looks like this:
================================================
<...connect to db stuff>
$id = $_GET['id']; //grabs ID value from URL
$query="SELECT * FROM news WHERE idx = $id";
$result=mysql_query($query) or die("MySQL Error:
".mysql_error()."\n<br/>SQL: ".$query);
$data=mysql_fetch_array($result);
<form name="form1" method="post" action="myupdatepage.php">
<label>Title
<input name="LinkTitle" type="text" id="LinkTitle" value="<? print
$data[name]?>" size="100" maxlength="200">
</label>
<p>
<label>Author
<input name="LinkAuthor" type="text" id="LinkAuthor" value="<? print
$data[author]?>" size="100" maxlength="200">
</label>
</p>
<p>
<textarea name="LinkText" cols="100" rows="50" id="LinkText"
value="<? print $data[body]?>"></textarea>
</p>
<p>
<label>Submit
<input type="submit" name="Submit" value="Submit">
</label>
</p>
</form>
================================================
the 'name' and 'author' values print all the time with no problem. The
body values sometimes print, sometimes print part of the data, and
sometimes print nothing.
I did notice this, though:
if one record's body contained "this is some text" without the quotes,
it wouldn't show up in the text area. I had another record with a body like
<p style="12">this is some text</p>
and it printed
this is some text</p>">
any rules or weirdness I'm not aware of when printing field contents to
textareas?
Navigation:
[Reply to this message]
|