Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 7th, 2006, 06:15 AM
no.mail.pls
Guest
 
Posts: n/a
Default 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=deleterecord.php?id=$row[0]&tablename=$tablename>$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


  #2  
Old March 7th, 2006, 06:35 AM
Geoff Muldoon
Guest
 
Posts: n/a
Default 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=deleterecord.php?id=$row[0]&tablename=$tablename>$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.php?id=$row[0]&tablename=$tablename/">$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="deleterecord.php?id='.$row[0].'&tablename='.
$tablename.'">'.$row[0].'</a>';

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

Geoff M
  #3  
Old March 7th, 2006, 07:05 AM
no.mail.pls
Guest
 
Posts: n/a
Default 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.1e77d1a3d56d871598977c@news.readfreenews. 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=deleterecord.php?id=$row[0]&tablename=$tablename>$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.php?id=$row[0]&tablename=$tablename/">$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="deleterecord.php?id='.$row[0].'&tablename='.
> $tablename.'">'.$row[0].'</a>';
>
> Although the fact that you have such text in an "id" field indicates poor
> design.
>
> Geoff M[/color]


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles