Hi All,

In the following code, the selected row from mysql database it populated in each cell, except for the "Content", where the syntax is slightly different, and obviously incorrect.

Please can somebody take a look at it for me and advise where it needs to be changed.

Thanks

<form action="#" method="post">
<p>EDIT ZONE  <?php echo $row['id'];?> </p>
<label>Title: <input type="text" name="Title" value="<?php echo $row['Title'];?>" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" value="<?php echo $row['Subtitle'];?>" /></label><br />
<label>Content: <textarea name="Content" value="<?php echo $row['Content'];?>" /></textarea></label><br />
<label>Author: <input type="text" name="Author" value="<?php echo $row['Author'];?>" /></label><br />
<label>Date: <input type="text" name="Date" value="<?php echo $row['Date'];?>" /></label><br />
<input type="submit" value="Submit" name="send" /></p>
</form>

Recommended Answers

All 5 Replies

<label>Content: <textarea name="Content" /><?php echo $row['Content'];?></textarea></label><br />

Pretty simple ? eh ? :)

Thanks very much for that one. Ive had a hell of a day bug fixing. swapping from php to html to java. and im fairly new at all this.

Very much appreciated

Ah! I see.. Happy learning :) Cheers!

Try this instead.
This should save you some headaches later down the road as well as save your error log.
textareas are suppose to have cols and rows set to properly validate.
isset will make sure not to load the var if it isn't set, thus saving your error log if any of these are not set for whatever reason.

<form action="#" method="post">
<p>EDIT ZONE  <?php echo isset($row['id']) ? $row['id'] : '';?> </p>
<label>Title: <input type="text" name="Title" value="<?php echo isset($row['Title']) ? $row['Title'] : '';?>" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" value="<?php echo isset($row['Subtitle']) ? $row['Subtitle'] : '';?>" /></label><br />
<label>Content: <textarea name="Content" cols="50" rows="5" /><?php echo isset($row['Content']) ? $row['Content'] : '';?></textarea></label><br />
<label>Author: <input type="text" name="Author" value="<?php echo isset($row['Author']) ? $row['Author'] : '';?>" /></label><br />
<label>Date: <input type="text" name="Date" value="<?php echo isset($row['Date']) ? $row['Date'] : '';?>" /></label><br />
<input type="submit" value="Submit" name="send" /></p>
</form>

Im going to test that now.

thank you both for your input. very much appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.