SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: calling array in url error
-
Jun 27, 2007, 03:19 #1
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
calling array in url error
Hi guys
I'm calling a array from my database
its a list of categories. Words like Construction are fine. But when its like
Media & Creative or Recruitment Consultancy
it stops displaying anything after the first word
it displays it ok when im printing it out, but when I call it in the url (please point your cursor over a two worder)
It only shows the first word
Thanks in advance for your help
-
Jun 27, 2007, 04:09 #2
How does the html source look like?
Saul
-
Jun 27, 2007, 04:17 #3
- Join Date
- Oct 2004
- Location
- uk
- Posts
- 853
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:<?php
$id = $_GET['id'];
$sql = " select * from category ORDER BY category ASC";
$result = mysql_query ($sql);
$i = 0;
$row = mysql_fetch_array( $result );
echo "<table width=100%><tr><td>";
while( $i<18 ) {
echo "<font size=2><A href=sector.php?category=$row[category]>$row[category]</a><br>";
$row = mysql_fetch_array( $result );
$i++;
}
echo "</td>";
echo "<td>";
while( $i >= 18 && $i<36 ) {
echo "<font size=2><A href=sector.php?category=$row[category]>$row[category]</a><br>";
$row = mysql_fetch_array( $result );
$i++;
}
echo "</td></tr></table>";
?>
-
Jun 27, 2007, 04:26 #4
I asked about the html source for a reason. If you checked that, the links would look like this:
Code:<A href=sector.php?category=Recruitment Consultancy>Recruitment Consultancy</a>
Quote the urls:
Code php:echo "<font size=2><A href=\"sector.php?category=$row[category]\">$row[category]</a><br>";
Saul
-
Jun 27, 2007, 07:10 #5
- Join Date
- Aug 2005
- Posts
- 453
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Use urlencode() to encode your get data parameters. The blank space will need to be replaced with a +.
Documentation @ : http://us.php.net/urlencodeComputers and Fire ...
In the hands of the inexperienced or uneducated,
the results can be disastrous.
While the professional can tame, master even conquer.
Bookmarks