text is truncated

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek @ Blueyonder

    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'><in put name='title' type='text' size='100'
    value=" . $title . "></td>");
    ?>


  • Geoff Berrow

    #2
    Re: text is truncated

    Message-ID: <RUsqg.30253$18 1.2462@fe3.news .blueyonder.co. ukfrom 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/

    Comment

    • Derek @ Blueyonder

      #3
      Re: text is truncated


      "Geoff Berrow" <blthecat@ckdog .co.ukwrote in message
      news:csmka25cqf 22udusthnhkbg8r hp2d4i7nq@4ax.c om...
      Message-ID: <RUsqg.30253$18 1.2462@fe3.news .blueyonder.co. ukfrom 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


      Comment

      • Kimmo Laine

        #4
        Re: text is truncated

        "Derek @ Blueyonder" <derekblakeyNOS PAM@NOSPAMbluey onder.co.ukwrot e in
        message news:S5tqg.3025 4$181.10037@fe3 .news.blueyonde r.co.uk...
        >
        "Geoff Berrow" <blthecat@ckdog .co.ukwrote in message
        news:csmka25cqf 22udusthnhkbg8r hp2d4i7nq@4ax.c om...
        >Message-ID: <RUsqg.30253$18 1.2462@fe3.news .blueyonder.co. ukfrom 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
        spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)


        Comment

        • Derek @ Blueyonder

          #5
          Re: text is truncated

          >>>>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
          spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.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



          Comment

          • Kimmo Laine

            #6
            Re: text is truncated

            "Derek @ Blueyonder" <derekblakeyNOS PAM@NOSPAMbluey onder.co.ukwrot e in
            message news:eBuqg.3026 1$181.10289@fe3 .news.blueyonde r.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
            spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)


            Comment

            • Derek @ Blueyonder

              #7
              Re: text is truncated

              >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
              spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.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'><te xtarea 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'><in put 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.


              Comment

              • Kimmo Laine

                #8
                Re: text is truncated

                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
                >spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.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'><te xtarea 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'><in put 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="checke d" 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ö
                spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)

                Comment

                • Geoff Berrow

                  #9
                  Re: text is truncated

                  Message-ID: <A7Pqg.273829$8 W1.180570@fe1.n ews.blueyonder. co.ukfrom
                  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'><te xtarea 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'><in put 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/

                  Comment

                  Working...