Posted by Geoff Muldoon on 03/07/06 08:23
no.mail@st.peters says...
> 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?
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
[Back to original message]
|