By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

text is truncated

P: n/a
Hi

Hope that this is the correct newsgroup for this, sorry if it is not.

I have the following code which is used to display the data brought back
from a MySQL database in an input box so that a user cam make changes before
resubmitting them.

If I display $myrow[2] all of the text is there, if I use the following code
only the first word is show The same happens if I simply use $myrow[2] and
replace the $title altogether.

How do I get it to show all of the text please?

Many thanks

<?php
$title = $myrow[2] ;
echo ("<td colspan='2'><input name='title' type='text' size='100'
value=" . $title . "></td>");
?>
Jul 4 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Message-ID: <RU******************@fe3.news.blueyonder.co.ukfro m Derek
@ Blueyonder contained the following:
>If I display $myrow[2] all of the text is there, if I use the following code
only the first word is show The same happens if I simply use $myrow[2] and
replace the $title altogether.

How do I get it to show all of the text please?
Does the entry contain quote marks?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 4 '06 #2

P: n/a

"Geoff Berrow" <bl******@ckdog.co.ukwrote in message
news:cs********************************@4ax.com...
Message-ID: <RU******************@fe3.news.blueyonder.co.ukfro m Derek
@ Blueyonder contained the following:
>>If I display $myrow[2] all of the text is there, if I use the following
code
only the first word is show The same happens if I simply use $myrow[2] and
replace the $title altogether.

How do I get it to show all of the text please?

Does the entry contain quote marks?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
No
Jul 4 '06 #3

P: n/a
"Derek @ Blueyonder" <de***************@NOSPAMblueyonder.co.ukwrote in
message news:S5*******************@fe3.news.blueyonder.co. uk...
>
"Geoff Berrow" <bl******@ckdog.co.ukwrote in message
news:cs********************************@4ax.com...
>Message-ID: <RU******************@fe3.news.blueyonder.co.ukfro m Derek
@ Blueyonder contained the following:
>>>If I display $myrow[2] all of the text is there, if I use the following
code
only the first word is show The same happens if I simply use $myrow[2]
and
replace the $title altogether.

How do I get it to show all of the text please?

Does the entry contain quote marks?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

No

Try like this:
<input name='title' type='text' size='100' value='" . $title . "'/>

The entire title is printed to the field if you view the source code*, but
in html code all literal attributes must be delimited with quote marks. If
not, only the first word is used.
*) ALWAYS view the source code to see what is actually printed, the
html-representation might not be accurate, like in this case. It turns out
you're dealing with html problem, not php.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Jul 4 '06 #4

P: n/a
>>>>If I display $myrow[2] all of the text is there, if I use the following
code
only the first word is show The same happens if I simply use $myrow[2]
and
replace the $title altogether.

How do I get it to show all of the text please?

Does the entry contain quote marks?
>No


Try like this:
<input name='title' type='text' size='100' value='" . $title . "'/>

The entire title is printed to the field if you view the source code*, but
in html code all literal attributes must be delimited with quote marks. If
not, only the first word is used.
*) ALWAYS view the source code to see what is actually printed, the
html-representation might not be accurate, like in this case. It turns out
you're dealing with html problem, not php.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Hi

Good one, that is working fine. And yes checking the source html it was
different to what was shown on the screen. Very strange.

Many thanks

Derek

Jul 4 '06 #5

P: n/a
"Derek @ Blueyonder" <de***************@NOSPAMblueyonder.co.ukwrote in
message news:eB*******************@fe3.news.blueyonder.co. uk...
>
>>>>>If I display $myrow[2] all of the text is there, if I use the following
>code
>only the first word is show The same happens if I simply use $myrow[2]
>and
>replace the $title altogether.
>
>How do I get it to show all of the text please?

Does the entry contain quote marks?
>>No


Try like this:
<input name='title' type='text' size='100' value='" . $title . "'/>

The entire title is printed to the field if you view the source code*,
but in html code all literal attributes must be delimited with quote
marks. If not, only the first word is used.
*) ALWAYS view the source code to see what is actually printed, the
html-representation might not be accurate, like in this case. It turns
out you're dealing with html problem, not php.

Hi

Good one, that is working fine. And yes checking the source html it was
different to what was shown on the screen. Very strange.
What's strange about browser not being able to display incorrect html? If
the code is corrupted like in this case it was, no wonder the browser cannot
correctly display it. That's why you should always alwasy make sure the html
your script produces is accurate, to make sure it's displayed correctly.
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Jul 5 '06 #6

P: n/a
>Hi

Good one, that is working fine. And yes checking the source html it was
different to what was shown on the screen. Very strange.

What's strange about browser not being able to display incorrect html? If
the code is corrupted like in this case it was, no wonder the browser
cannot correctly display it. That's why you should always alwasy make sure
the html your script produces is accurate, to make sure it's displayed
correctly.
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
You are correct, wrong HTML and the results will be unpredictable.

Now that I understand what I was doing wrong I have applied the same process
to a text area but this will not display any text at all, code below.

echo ("<td colspan='2'><textarea name='extract' cols='100' rows='5' value='
" . $myrow[3] . " '></textarea></td>");

Are text areas treated in a different way?

Any finaly if I may checkboxes, can values be loaded into them in the same
sort of way as you explained above? The code is

echo ("<td width='427'><input type='checkbox' name='childhood' value=" .
$myrow[27] ."></td>");

The value being loaded in is either a 1 or 0. I would like it to place a
tick in the checkbox if the value loaded is a 1.

As you have probably realised this is the first time since taking a basic
PHP course that I have used PHP, on the course everything always works OK
but this is real life!

I have googled and found several websites that do tutorials for PHP but none
seem to cover this requirement, does anyone know of any sites they could
recommend please.

Any help you could give is appreciated.
Jul 5 '06 #7

P: n/a
Derek @ Blueyonder kirjoitti:
>>Hi

Good one, that is working fine. And yes checking the source html it was
different to what was shown on the screen. Very strange.
What's strange about browser not being able to display incorrect html? If
the code is corrupted like in this case it was, no wonder the browser
cannot correctly display it. That's why you should always alwasy make sure
the html your script produces is accurate, to make sure it's displayed
correctly.
--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)

You are correct, wrong HTML and the results will be unpredictable.

Now that I understand what I was doing wrong I have applied the same process
to a text area but this will not display any text at all, code below.
Textareas have no value attribute, instead, the value is placed between
the textarea tags like this:
echo ("<td colspan='2'><textarea name='extract' cols='100' rows='5'>" .
$myrow[3] . "</textarea></td>");
>
Are text areas treated in a different way?

Any finaly if I may checkboxes, can values be loaded into them in the same
sort of way as you explained above? The code is

echo ("<td width='427'><input type='checkbox' name='childhood' value=" .
$myrow[27] ."></td>");
Yes indeed, that works. In case you sometimes need to checkbox checked
by default just insert the checked="checked" attribute in the tag.

Here's something you might find interesting:
http://www.w3.org/TR/html4/interact/forms.html the complete html 4.01
specification regarding forms.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Jul 5 '06 #8

P: n/a
Message-ID: <A7*********************@fe1.news.blueyonder.co.uk from
Derek @ Blueyonder contained the following:
>You are correct, wrong HTML and the results will be unpredictable.

Now that I understand what I was doing wrong I have applied the same process
to a text area but this will not display any text at all, code below.

echo ("<td colspan='2'><textarea name='extract' cols='100' rows='5' value='
" . $myrow[3] . " '></textarea></td>");

Are text areas treated in a different way?
Yes. The 'value' is whatever you put in between the tags
>
Any finaly if I may checkboxes, can values be loaded into them in the same
sort of way as you explained above? The code is

echo ("<td width='427'><input type='checkbox' name='childhood' value=" .
$myrow[27] ."></td>");

The value being loaded in is either a 1 or 0. I would like it to place a
tick in the checkbox if the value loaded is a 1.
To put tick in a checkbox you have to add the word 'checked'. You need
to write code to add this based on the value in your database. And
don't forget, checkboxes and radio buttons don't return a value unless
checked.
>
As you have probably realised this is the first time since taking a basic
PHP course that I have used PHP, on the course everything always works OK
but this is real life!
Your PHP seems fine but your html sucks <g>.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 5 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.