Forum Moderators: coopster
I'm know a little php but not enough to figure out why I get this error message.
Parse error: syntax error, unexpected T_CASE in /home/slnlibrary/public_html/scripts/Search.php on line 8
Any idea would be very appreciated.
casethingy inside a switch [php.net] construction. Maybe the preceding
casethingy is not ended properly with a
breakstatement?
Perhaps you could post the first 10 lines of the script; that might clarify things.
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING on line 3
Help is appreciated greatly. My script might be way off and beyond fixing. Let me know. I won't take offense. But if it's pretty close it might be worthwhile for me to keep pluggin away. I appreciate your comments even if you can't give me a quick solution.
This is my script
(I'm trying to make three searches in one, which we used to have in ASP. Maybe it's not even possible in PHP?)
<?php
//Get Form Info
function $str_SearchArg=Request("PACTERMS");
$str_SearchArg=str_replace( " ", "+",$str_SearchArg);
$str_SearchScope=Request("searchscope");
switch ($str_SearchScope)
{
case "sitesearch";
//Atomz
$str_SearchString="http://search.atomz.com/search/?"."sp-q=".$str_SearchArg."&sp-a=sp10028b7a&sp-p=all&sp-f=ISO-8859-1";
break;
case "catalog";
$str_SearchType="GENERAL^SUBJECT^GENERAL^^words+or+phrase";
$str_SearchString="http://64.107.155.140/uhtbin/cgisirsi/x/LINCOLNWD/0/57/5?";
$str_SearchString=$str_SearchString."searchdata1=".$str_SearchArg;
$str_SearchString=$str_SearchString."&srchfield1=".$str_SearchType;
$str_SearchString=$str_SearchString."&library=LINCOLNWD";
$str_SearchString=$str_SearchString."&user_id=lnkibistro";
$str_SearchString=$str_SearchString."&password=ibistro";
break;
case "Internet";
//Google
$str_SearchString="http://www.google.com/search?q=".$str_SearchArg."&safe=active"."&num=20";
break;
}
?>
Part of my html form looks like this
<input type="radio" name="searchscope" value="Internet" checked="checked" />
Google
<input type="radio" name="searchscope" value="sitesearch" />
This Site
<input type="radio" name="searchscope" value="catalog" />
Library's Catalog<br />
<input type="text" name="PACTERMS" size="42" />
<input type="submit" class="BUTTON" value="Search" />
</form>
function $str_SearchArg=Request("PACTERMS");
there shouldn't be a $ there, you should have the function name
I am guessing you could remove the word function as I don't see that you have a function there
there is also another syntax error
case "sitesearch";
your case should end with : not ;