Jump to content

spaces


ecabrera

Recommended Posts

ok so when my code dipsplays i get the spaces i add in the db but when i updae it dispalys this rnrnrn and its all together

Code

<?php
include "scripts/connect.php";

if(isset($_GET['edit'])){

$newid = $_GET['edit'];

$query = mysql_query("SELECT * FROM news WHERE id='$newid' LIMIT 1");
$rows = mysql_fetch_array($query);

$newstitle = $rows['title'];
$newsby = $rows['by'];
$newsbody = $rows['body'];

}

if(isset($_POST['saveedit'])){

$newid = mysql_real_escape_string($_POST['saveedit']);
$newstitle = mysql_real_escape_string($_POST['title']);
$newsby  = mysql_real_escape_string($_POST['by']);
$newsbody = mysql_real_escape_string($_POST['body']);

if ($newstitle && $newsby && $newsbody){

$query = mysql_query("UPDATE news SET title='$newstitle', 'by'='$newsby', body='$newsbody' WHERE id='$newid'") or die(mysql_error());

echo "UPDATE SUCCESFULLY!";

}else
   $msg = "<font color=red>YOU DID NOT FILL ALL OF THEM IN!</font>";
}
?>
<form action='enews.php' method='POST'>
<table>
<tr>
<td></td>
<td><?php echo "$msg"; ?></td>
</tr>
<tr>
<td>Article Title</td>
<td><input type='text' name='title' size='45' value='<?php echo $newstitle; ?>'/></td>
</tr>
<tr>
<td>By:</td>
<td><input type='text' name='by' size='30' value='<?php echo $newsby; ?>' /></td>
</tr>
<tr>
<td>Article Body</td>
<td><textarea cols='45' rows='25' name='body'><?php echo  stripslashes($newsbody); ?></textarea></td>
</tr>
<tr>
<td><input type='hidden' name='saveedit' value='<?php echo $newid; ?>'/></td>
<td><input type='submit' name='updatebtn' value='Update' /></td>
</tr>
</table>
</form>
</div>

Link to comment
Share on other sites

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.