Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie needs help with QueryString

Status
Not open for further replies.

jimny

Technical User
Oct 18, 2002
52
US
I inherited a PERl/PHP(and I am not familiar with) site and am getting an error when looking for a querystring value.

the original HREF is like:

<A class=listLink
href=&quot;artist_frame.shtml?artist_id=10&quot;
target=cag_content>Artist 10</A>

and the code on the recieving page is:
Code:
#!/usr/local/bin/php 
<?php
$id = $HTTP_GET_VARS['artist_id'];

?>

and returns:

Notice: Undefined index: artist_id in C:\Inetpub\mysite\cgi\artist_frame.php on line 3

Is there something that I need to enable &quot;$HTTP_GET_VARS[]&quot; on the server? Otherwise I tried capturing the artist_id value from the querystring using:

($key, $id) = split(/=/,$ENV{'QUERY_STRING'},2);
#since there is only one variable

and I get:

Parse error: parse error, unexpected ',' in artist_frame.php on line 4

if I go with:

@vals = split(/=/,$ENV{'QUERY_STRING'});

I get:
Parse error: parse error, unexpected '=' in artist_frame.php on line 4

All this leads me to believe I a missing something on the server. Any suggestions?
Thanks....
 
Thanks for the quick response.

I checked &quot;artist_frame.shtml&quot; and it contains a redirect(?)
Code:
<!--#exec cgi=&quot;/cgi/artist_frame.php&quot;-->

I tried changing the HREF to &quot;artist_frame.php&quot; and got a &quot;page cannot be found&quot; error.

How would I capture the id value and then pass it?
like:

Code:
$id= $cgi->param('artist_id');
<!--#exec cgi=&quot;/cgi/artist_frame.php?artist_id=&quot;$id-->

Sorry for being so inept...I will definitely be looking in to PERL/PHP after this!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top