Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

text field and mysql .....

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

text field and mysql .....

Postby cho@ » Fri Aug 09, 2002 6:58 am

hi

little prob...

i wanna insert in a textfield a value in my Db....but when there is more than one word....only the first one appears in the text input...


wot the solution?
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby DoppyNL » Fri Aug 09, 2002 7:24 am

its not quite clear to me where you're problem lies, my best guess is you have a little html-problem, just yell at me when I still got it wrong :)

You're input field in the html file doesn't contain the default value you expected, try this:
Code: Select all
<input type="text" name="stupidfield" value="default value">


Greetz Daan
DoppyNL
 

Postby cho@ » Mon Aug 12, 2002 1:32 am

No in fact i mean....

in my Db fiels i have this value..."my link name" ok..
and then when i put this value in a text files in my form

echo"<td><input name=\"Name1\" type=\"text\" size=\"20\" maxlength=\"20\" value=";
if($Row[Linkname1]){
print($Row[Linkname1]);}
echo"></td>";

i have only the value "my" in my text field.....


shall i add that i have the same prob 4 my update...

thx 4 ur helps
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby DoppyNL » Mon Aug 12, 2002 1:37 am

cho@ wrote:No in fact i mean....
echo"<td><input name="Name1" type="text" size="20" maxlength="20" value=";
if($Row[Linkname1]){
print($Row[Linkname1]);}
echo"></td>";

i have only the value "my" in my text field.....


the value is only "my" because it's not between "
because you use echo like this:
Code: Select all
echo " text to echo "

it is a bit difficult to see what is actually printed to the page and what's not.
perhaps you can use ' like this:
Code: Select all
print('<td><input name="Name1" type="text" size="20" maxlength="20" value="');
if($Row[Linkname1]){
print($Row[Linkname1]);}
print('"></td>');

when using ' you don't have to escape the spacial characters.

Greetz Daan
DoppyNL
 

Postby cho@ » Mon Aug 12, 2002 1:44 am

ok i will try that

tahnxs a lot... :lol:
cho@
New php-forum User
New php-forum User
 
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby Jay » Mon Aug 12, 2002 2:24 am

cho@ wrote:No in fact i mean....

in my Db fiels i have this value..."my link name" ok..
and then when i put this value in a text files in my form

echo"<td><input name="Name1" type="text" size="20" maxlength="20" value=";
if($Row[Linkname1]){
print($Row[Linkname1]);}
echo"></td>";

i have only the value "my" in my text field.....


shall i add that i have the same prob 4 my update...

thx 4 ur helps

That will simply output:

<td><input name="Name1" type="text" size="20" maxlenght="20" value=my link name"></td>

You forgot the opening quotation marks for the value!

dvdbinternet wrote:when using ' you don't have to escape the spacial characters.
Greetz Daan

It's worst than that, special characters are only special between double quotes, single quotes interpret a string literally.
Code: Select all
<?
$string = "This is my string";

print "The string is '$string'\nthat was it"; //Outputs The string is 'This is my string'
that was it

print 'The string is "$string"\nthat was it"; //Outputs The string is "$string"\nthat was it
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.