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 />'; } Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/ 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 Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300249 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? Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300264 Share on other sites More sharing options...
jitesh Posted July 17, 2007 Share Posted July 17, 2007 Post error with code Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300266 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 Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300270 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 Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300277 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']; Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300278 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 ? Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300283 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. Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300286 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. Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300289 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... Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300292 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 Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300301 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... Link to comment https://forums.phpfreaks.com/topic/60351-can-i-pass-multiple-values-in-a-query-string/#findComment-300305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.