473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

text is truncated

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
8 2066
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

"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
"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
>>>>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
"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
>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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Guinness Mann | last post by:
I'm running SQL Server 2K (sp3a) and when I run the following query (in query analyzer): SELECT id, LEN(ForeignWord) as Length, ForeignWord FROM Words WHERE Language ='Thai' and...
1
by: relaxedrob | last post by:
Hi All! I am using the DB2 CLP tool and want to format my text columns in a query to truncate the results of a wide text field - 50 char field but I want to display only the first 10 chars. ...
4
by: Jay | last post by:
This is a strange one that I can't seem to find a fix for. We have a Billing DB application (Access 2000 format) where we upload billing info in a comma delimited text file to our printer who...
2
by: Jon Davis | last post by:
Seems that there's a bug in the TreeNode object. When you change the font, it does not readjust its size appropriately. The following code shows the boldface text truncated with everything after...
8
by: michele | last post by:
Hi, i have in my crystal report viewer .net a multiline field. When i preview the report, the text in the field is clipped on the right, so some words are invisible... i'm going mad; i've searched...
7
by: Terry Brown | last post by:
I have a problem where, depending on the text of a button, the display of that text seems to change size or alignment. Here is the code: HomeScoreNameButton.ForeColor = Color.Green;...
0
by: Terry Brown | last post by:
I have a problem where, depending on the text of a button, the display of that text seems to change size or alignment. Here is the code: HomeScoreNameButton.ForeColor = Color.Green;...
5
by: Dinsdale | last post by:
I have an application that recieves text data via external input (i.e. serial) and displays it on the screen (we use carraige return as a delimiter). At this point I use a regular old text box and...
0
Krishna Ladwa
by: Krishna Ladwa | last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
2
by: Dennis | last post by:
I am using VS 2005. I have a form with a TreeView. I want to change the font of the root node to bold. But when I do, running the program causes the text in that node to appear truncated ... as if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.