Jump to content

Recommended Posts

Hello everyone,

 

I'm converting my plain html website into a php one, and I'm working on the backend now...

I built a page to submit articles to MySQL, and another page to list all the entries in the

database, from there I can link to the article editing page to call up article headline, body and

date etc. into their own field in a form...However, the editing page is not working properly...

I made some screen captures to describe the problem...

 

1. http://www.prophet-records.com/images/phpprob01.gif This is my article submitting

page, I captured it to show you what supposed to be in the article...

 

2. http://www.prophet-records.com/images/phpprob02.gif This is the article editing

page...as you can see...article headline and date showed up, but the textareas appear to be

empty.

 

3. http://www.prophet-records.com/images/phpprob03.gif I checked its source code

with my browser, the highlighted part is where the article body is, it seems alright there, but it

just doesn't appear on the web page....

 

Below is the code for the article editing page....

<?php
$con = mysql_connect("hostname","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("dbname", $con);

$sql = mysql_query("SELECT * FROM table WHERE fname='$fname'") or die(mysql_error());

while ($rw = mysql_fetch_assoc($sql)) {
//now we display a form with the users info in text boxes and areas.
echo '<form action="update.php?fname='.$rw['fname'].'" method="post">
<table width="510" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="38" align="left" valign="top"><a href="dataentry.php">Add</a>  |  <a href="datalist.php">List</a>  |  <a href="annuallist.php">Annual</a></td>
</tr>
<tr>
<td height="28" align="left">Title: <input name="headline" type="text" maxlength="40" value="'.$rw['headline'].'">
</td>
</tr>
<tr>
<td align="left">Content:<br><textarea name="newscont" cols="70" rows="15" value="'.$rw['newscont'].'"></textarea>
</td>
  	</tr>
<tr>
<td align="left"><input name="date" value="'.$rw['date'].'">
</td>
</tr>
<tr>
<td align="left">Brief:<br><textarea name="newsbrf" cols="70" rows="10" value="'.$rw['newsbrf'].'"></textarea>
</td>
</tr>
<tr>
<td height="28" align="left">File Name: <input name="fname" type="text" maxlength="30" value="'.$rw['fname'].'">
</td>
</tr>
<tr>
<td height="32" align="center"><input type="submit">
</td>
</tr>
</table>
</form>';
}

mysql_close($con)
?>

 

Would anyone tell me what went wrong?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.