Select Query Displaying Funky in Text Box

A

Anonymous

Guest
The site that I am developing allows users to login and add their contributions to a self-publishing book review board.

The problem that I am having is that the following select statement refuses to put more than one word in either the "Work Reviewed" or " "Review Title" form fields on the "edit" page. The edit page allows users to go back and make corrections to previous reviews.

Also, PHP is adding extra space in the $reviewbody field every time it loads into the edit page. I tried using a multiline text box, like that of $reviewbody, for the Title and Work Reviewed fields and I got a similar result. For some reason, extra space is getting added into the variables just as they load.

I checked the DB and there are no extra spaces there. The datatypes are tinytext, tinytext and text respectively (if that matters here). I sort of assumed I was having an SQL issue at first, but then the data appears to be normal. This is weirding me out. :cry:

here's the code:

$reviewquery =("SELECT * FROM reviews WHERE reviewid='".$reviewid."'");
$result= mysql_query($reviewquery);
if(!$result)
die(mysql_error());


$row = mysql_fetch_array($result);
extract($row);

Echo "

<table><form action='updatereviews.php' method='POST'> \n
<tr>
<tr><td>Review Date:</td><td> $reviewdate</td>\n
</tr>
<tr>
<td>Work Reviewed:</td>
<td><INPUT TYPE='text' NAME='reviewedwork' size='60' value=$reviewedwork></td>
</tr>
<tr>
<td>Review Title:</td>
<td><INPUT TYPE='text' NAME='reviewtitle' size='80' value-$reviewtitle></td>
</tr>\n
<tr>
<td>Review Rating:</td>
<td>";

//I have a series of if statements that figure out which radio button should be checked in this section. That seems to be working fine.

$reviewdate = date("Y-m-d");

echo "</td><tr></table><TEXTAREA NAME='reviewbody' ROWS='20' COLS='90' WRAP='virtual'>
$reviewbody</textarea><br><br>\n
<INPUT TYPE='hidden' NAME='reviewid' VALUE=$reviewid> \n
<INPUT TYPE='hidden' NAME='reviewdate' VALUE=$reviewdate> \n
<INPUT TYPE='hidden' NAME='reviewerid' VALUE=$reviewerid> \n
<INPUT TYPE='hidden' NAME='logonuserpassword' VALUE=$userpasstxt>\n
<INPUT TYPE='hidden' NAME='logonusername' VALUE=$username> \n
<INPUT TYPE='Submit' NAME='updatereviews' VALUE='Update Review'></form></table><br>";


I'd really appreciate any advice you guys could give. Thanks a bunch.

-Chad (hat firmly in hand)
 
add quotes around the output variables

basically your syntax forces a html error

<input value=blat fooey /> would only display blat

<input value="blat fooey" /> would display blat fooey
 
Your advice worked perfectly; I'm back on track thanks to your help. I must admit my relative 'newbidity' in the area of PHP, and I appreciate your taking a minute to straighten me out. Thanks again.

Cheers,
-Chad
 
Back
Top