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
https://forums.phpfreaks.com/topic/253644-spaces/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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