|
|
Subject:
Why Are Spaces Breaking the Line in a Text Input Field? (PHP & MYSQL)
Category: Computers > Programming Asked by: martinluther245-ga List Price: $10.00 |
Posted:
03 Aug 2004 15:26 PDT
Expires: 02 Sep 2004 15:26 PDT Question ID: 383109 |
The form is located at: http://128.241.191.192/test/approvelistings.php I'm wondering why my category field isn't working properly. The line stops immediately upon a space. I've tried htmlentities and urlencode but that doesn't seem to be the issue. Here's a sample from the php: while ($newArray = mysql_fetch_array($result)) { //give a name to the fields $category = $newArray['category']; $email = $newArray['email']; $phone = $newArray['phone']; $adtext = $newArray['adtext']; $ip = $newArray['ip']; $id = $newArray['id']; $postdate = $newArray['time']; $replysubject = rawurlencode("Re: Problem With Your Ad on Ocala4sale.com"); $replycontent = rawurlencode("\n\n***********************\nHere is the ad you submitted:\n\n$adtext Phone: $phone E-mail: $email"); //echo the results on screen print "<tr align=left><b>AD:</b> $id    <b>IP:</b> <a href=http://whois.sc/$ip target=_blank>$ip</a>    <b>POSTED:</b> $postdate<br>"; print "<input type=hidden name=id[] value=$id>"; print "<input type=text size=40 name=category[] value="; echo htmlentities($category); print "><br>"; print "<textarea rows=6 cols=60 name=adtext[]>$adtext</textarea><br>"; print "<input type=text size=40 name=email[] value=$email> <a href=http://google.com/search?q=$email target=_blank>Google</a> | History <br>"; print "<input type=text size=40 name=phone[] value=$phone> <a href=http://google.com/search?q=$phone target=_blank>Google</a> | History <br>"; print "<input type=radio value='yes' name=approved" . $id ."> Approved <input type=radio value='no' name=approved" . $id ."> Declined <input type=radio value='pending' name=approved" . $id ."> Pending     [ <a href=mailto:$email?subject=$replysubject&body=$replycontent> Click to Reply</a> ]<br><br><br></tr>"; } print "</table><br>"; |
|
There is no answer at this time. |
|
Subject:
Re: Why Are Spaces Breaking the Line in a Text Input Field? (PHP & MYSQL)
From: mike_sysadmin-ga on 03 Aug 2004 19:08 PDT |
Hi martinluther245, The problem you are experiencing is easily resolved by adding single or double quotes to the text field names and values. You can only ommit the quotes when the text field properties do not have special characters, spaces includes. You could so something like this: print "<input type=\"text\" size=\"40\" name=\"category[]\" value=\"" . $category . "\">"; Also, you might consider using strip_tags() instead of urlencode or htmlentities. - Mike |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |