Sent data truncated?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • no.mail.pls

    Sent data truncated?

    Hi,

    I can't send data over to another page, if the data has spaces in-between,
    eg.

    $row[0] = "Garden Party by the Sea" and i use the following code:

    <a href=deletereco rd.php?id=$row[0]&tablename=$tab lename>$row[0]</a>";

    then what is sent over is
    $row[0]="Garden
    and $tablename is not sent over at all.

    How can i send over the complete $row[0] plus another variable to the next
    page?

    TIA


  • Geoff Muldoon

    #2
    Re: Sent data truncated?

    no.mail@st.peters says...
    [color=blue]
    > I can't send data over to another page, if the data has spaces in-between,
    > eg.
    >
    > $row[0] = "Garden Party by the Sea" and i use the following code:
    >
    > <a href=deletereco rd.php?id=$row[0]&tablename=$tab lename>$row[0]</a>";
    >
    > then what is sent over is
    > $row[0]="Garden
    > and $tablename is not sent over at all.
    >
    > How can i send over the complete $row[0] plus another variable to the next
    > page?[/color]

    This is not a PHP thing, it's a HTML thing. HTML property references (like
    href and value) which are not enclosed in double quotes will break at the
    first whitespace.

    Try using escaped quotes (/"):
    $link="<a href=/"deleterecord.p hp?id=$row[0]&tablename=$tab lename/">$row
    [0]</a>";

    or I prefer to use single-quotes and concatenators for PHP and double-
    quotes only for the HTML bits:

    $link='<a href="deleterec ord.php?id='.$r ow[0].'&tablename=' .
    $tablename.'">' .$row[0].'</a>';

    Although the fact that you have such text in an "id" field indicates poor
    design.

    Geoff M

    Comment

    • no.mail.pls

      #3
      Re: Sent data truncated?

      Hi Geoff,

      Thanks. It worked after i changed it to \"

      i agree that it is poor db design, by using such variable data as primary
      key. But my purpose is to create a general method for anyone to create any
      table with any number of fields of their own choice, and no assumption is
      made regarding their knowledge of db design.

      All they have to do is live with what they have created. :-)

      cheers


      "Geoff Muldoon" <geoff.muldoon@ trap.gmail.com> wrote in message
      news:MPG.1e77d1 a3d56d871598977 c@news.readfree news.net...[color=blue]
      > no.mail@st.peters says...
      >[color=green]
      >> I can't send data over to another page, if the data has spaces
      >> in-between,
      >> eg.
      >>
      >> $row[0] = "Garden Party by the Sea" and i use the following code:
      >>
      >> <a href=deletereco rd.php?id=$row[0]&tablename=$tab lename>$row[0]</a>";
      >>
      >> then what is sent over is
      >> $row[0]="Garden
      >> and $tablename is not sent over at all.
      >>
      >> How can i send over the complete $row[0] plus another variable to the
      >> next
      >> page?[/color]
      >
      > This is not a PHP thing, it's a HTML thing. HTML property references (like
      > href and value) which are not enclosed in double quotes will break at the
      > first whitespace.
      >
      > Try using escaped quotes (/"):
      > $link="<a href=/"deleterecord.p hp?id=$row[0]&tablename=$tab lename/">$row
      > [0]</a>";
      >
      > or I prefer to use single-quotes and concatenators for PHP and double-
      > quotes only for the HTML bits:
      >
      > $link='<a href="deleterec ord.php?id='.$r ow[0].'&tablename=' .
      > $tablename.'">' .$row[0].'</a>';
      >
      > Although the fact that you have such text in an "id" field indicates poor
      > design.
      >
      > Geoff M[/color]


      Comment

      Working...