Select Query Displaying Funky in Text Box

Codes here !

Moderators: egami, macek, gesf

Post Reply

Wed Mar 12, 2003 4:43 pm

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);

$row = mysql_fetch_array($result);

Echo "

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

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Thu Mar 13, 2003 1:32 am

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
avatar image based upon nasas apod (only updates if I post though)


Thu Mar 13, 2003 9:24 pm

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.


Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest