Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
using $_GET[] but problem with '&' in keyword.
Old 03-02-2010, 07:07 AM using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi,

I am using $_GET[] for getting data from url..........its working fine but not showing data after '&'

For example I searched for the keyword: Ac Repairs & Services but its taking only Ac Repairs.....no data after '&'

Can anyone tell me as why its not taking value after & and how can I solve it.

Thanks
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-02-2010, 07:14 AM Re: using $_GET[] but problem with '&' in keyword.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
"&" is a delimiter in querystrings and spaces are NOT allowed in key values.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-02-2010, 07:17 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by chrishirst View Post
"&" is a delimiter in querystrings and spaces are NOT allowed in key values.

Thanks,

Is there any solution of it...???
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-02-2010, 07:18 AM Re: using $_GET[] but problem with '&' in keyword.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
URL encode the phrases
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-02-2010, 08:36 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by chrishirst View Post
URL encode the phrases
Thanks, I am doing it like this......

PHP Code:
<?
    $value 
urlencode('$row_category['category']');
                        
                       echo 
"<a href=\"../srch/serachkey.php?id=Meerut&amp;title=$value\" class="left_txt">";
                       echo 
$row_category['category'];
                       
'</a>'
?>
but its flagging an error : syntax error, unexpected T_STRING in.....

Any suggestion would be appreciated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-02-2010, 08:41 AM Re: using $_GET[] but problem with '&' in keyword.
Junior Talker

Posts: 1
Name: Ivan
Trades: 0
<?
$value = rawurlencode($row_category['category']);

echo "<a href=\"../srch/serachkey.php?id=Meerut&amp;title=$value\" class=\"left_txt\">";
echo $row_category['category'];
echo '</a>';
?>
halfdata is offline
Reply With Quote
View Public Profile
 
Old 03-02-2010, 08:45 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by halfdata View Post
<?
$value = rawurlencode($row_category['category']);

echo "<a href=\"../srch/serachkey.php?id=Meerut&amp;title=$value\" class=\"left_txt\">";
echo $row_category['category'];
echo '</a>';
?>

Thanks A lot!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-02-2010, 08:47 AM Re: using $_GET[] but problem with '&' in keyword.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
LOOK at the syntax colouring in your post!

PHP Code:
 echo '<a href=\"../srch/serachkey.php?id=Meerut&amp;title=$value\" class="left_txt">'
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-02-2010, 09:09 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Quote:
Originally Posted by chrishirst View Post
LOOK at the syntax colouring in your post!

PHP Code:
 echo '<a href=\"../srch/serachkey.php?id=Meerut&amp;title=$value\" class="left_txt">'
Yes, you are right.

I got it now, I hope this can be applied to Js as well...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-03-2010, 12:53 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Thanks to all you have replied.......but I am not sure how can I encode through JS?? I was advised that its same in php and JS but I feel its different.

So can anyone please tell me how can I encode user text in Javascript.

I am doing something like this.....

Quote:
var b=document.getElementById('get_searchword').value;
document.getElementsByTagName('form')[0].action="srch/searchkey.php?id=Meerut&amp;title="+escape(b)+"";
Please help me.......Thanks
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes

Last edited by Isabella_Smith; 03-03-2010 at 01:01 AM..
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-03-2010, 01:26 AM Re: using $_GET[] but problem with '&' in keyword.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
I solved it.......working now.........and its jst your help............you guys make me able to learn and solve problem.........well, if there any better suggestion, I'll appreciate it.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 03-03-2010, 03:37 AM Re: using $_GET[] but problem with '&' in keyword.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by Isabella_Smith View Post
Thanks to all you have replied.......but I am not sure how can I encode through JS??
http://www.w3schools.com/jsref/jsref_escape.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to using $_GET[] but problem with '&' in keyword.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44654 seconds with 12 queries