Lassie Posted July 17, 2007 Share Posted July 17, 2007 I need to pass a couple of values in a query string. Is this possible. I have the following code but get a parse error. function display_categories($cat_array) { if (!is_array($cat_array)) { echo 'No categories currently available<br/>'; return; } echo '<ul>'; foreach ($cat_array as $row) { $url = 'show_cat.php?region_id='.($row['region_id']).country=.($row['country'])'; $title = $row['region_desc']; echo '<li>'; do_html_url($url, $title); echo '</li>'; } echo '</ul>'; echo '<hr />'; } Quote Link to comment Share on other sites More sharing options...
tapos Posted July 17, 2007 Share Posted July 17, 2007 $url = 'show_cat.php?region_id='.($row['region_id']).country=.($row['country'])'; this should be $url = 'show_cat.php?region_id='.($row['region_id']).'&country='.($row['country'])'; -- Tapos Pal Quote Link to comment Share on other sites More sharing options...
Lassie Posted July 17, 2007 Author Share Posted July 17, 2007 Thanks Tapos. I am now getting a parse error (Unepected t constant etc) on the next line. I cant see a problem with it. Any ideas? Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 17, 2007 Share Posted July 17, 2007 Post error with code Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 17, 2007 Share Posted July 17, 2007 try using this: $url = 'show_cat.php?region_id='.($row['region_id'])&country=.($row['country'])'; pls tell me wheter it worked or not...if u get error, what is the error ? Note: i used ampersand Quote Link to comment Share on other sites More sharing options...
Lassie Posted July 17, 2007 Author Share Posted July 17, 2007 Hi thanks for coming back. I get a parse error for that line which is unexpected'='in ect line 33. I am alos getting a fatal error . Call to undefine function do_html_url() which has worked perfectly well until now.Code for that function is function do_html_url($url, $title) { // output URL as link and br ?> <a href="<?php echo $url; ?>"><?php echo $title; ?></a><br /> <?php } Thanks for your help Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 17, 2007 Share Posted July 17, 2007 $url = "show_cat.php?region_id=".$row['region_id']."&country=".$row['country']; Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 17, 2007 Share Posted July 17, 2007 ok...there was some bugs in fact..use this instead: $url = "show_cat.php?region_id='.($row[region_id]).&country=.($row[country])"; does it work ? Quote Link to comment Share on other sites More sharing options...
Lassie Posted July 17, 2007 Author Share Posted July 17, 2007 Hi thanks for that. Yes it works.So far so good.I will plough on with the rest of it. Quote Link to comment Share on other sites More sharing options...
Lassie Posted July 17, 2007 Author Share Posted July 17, 2007 sorry spoke too soon. i have no value in country. It should be a name. Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 17, 2007 Share Posted July 17, 2007 try this : $url = "show_cat.php?region_id='.($row[region_id]).'&'.country=.($row[country]).' "; hope it works... Quote Link to comment Share on other sites More sharing options...
Lassie Posted July 17, 2007 Author Share Posted July 17, 2007 Thanks Jd both work.I forgot to amend my db query to retireve the country value. Many thanks. lassie Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 17, 2007 Share Posted July 17, 2007 you're welcome...if u need anything, message me...i'm always online... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.