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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't understand this error Message 2

Status
Not open for further replies.

sazebac

Technical User
Joined
Apr 16, 2003
Messages
117
Location
US
I'm using PHP 4.3, Apache 2.0, and Mysql 4.0 to run the following code on my Win 2K Pro machine. once I open my browser the form loads fine, but once I click on the submit button with ALL in the text area, I get the following error message:

Forbidden
You don't have permission to access /<br /><b>Notice</b>: Use of undefined constant scriptName - assumed 'scriptName' in <b>C:/Program Files/Apache Group/Apache2/htdocs/TMP21ctvg80eo.php</b> on line <b>42</b><br />scriptName on this server.
--------------------------------------------------------------------------------
Apache/2.0.46 (Win32) Server at localhost Port 80


Not sure why I am getting this error message. Have run several succesful examples of querying from the Mysql database already. Any help is appreciated. Thanks.



<html>
<body>
<?php
include 'db.inc';
include 'error.inc';
function displayWinesList($connection, $query, $regioname)
{
if (!($result = @ mysql_query ($query, $connection)))

showerror();

$rowsFound = @ mysql_num_rows($result);

if ($rowsfound > 0)
{
echo &quot;Wines of $regionName<br>&quot;;

echo &quot;\n<table>\n<tr>&quot; .
&quot;\n\t<th>\wine id</th>&quot; .
&quot;\n\t<th>\wine name</th>&quot;;

while ($row = @ mysql_fetch_array($result))
{
echo &quot;\n<tr>&quot;.
&quot;\n\t<td>&quot; . $row[&quot;wine_id&quot;] . &quot;</td>&quot; .
&quot;\n\t<td>&quot; . $row[&quot;wine_name&quot;] . &quot;</td>&quot; .
&quot;\n</tr>&quot;;
} //end while loop
echo &quot;\n</table>&quot;;
} //end of $rowsFound

echo &quot;$rowsFound records found matching your black ass, biaatach<br>&quot;;
} //end of function

$scriptName = &quot;test2.php&quot;;

if(empty($regionName))
{
?>

<form action=&quot;<?=scriptName;?>&quot; method=&quot;get&quot;>
<br>Enter a region, you fuck:
<input type=&quot;text&quot; name = regionName value = all>
(type all to see all regions)
<br>
<input type=submit value=click this, asshole>
</form><br>
<a href=index.html>Home</a>

<?php
}
else
{
$regionName = clean($regionName, 30);

if (!($connection = @ mysql_connect($hostname, $username, $password)))
die(&quot;could not connect to DB&quot;);

if (!mysql_select_db($databaseName, $connection))
showerror();

//start a query
$query = &quot;SELECT w.wine_id,
w.wine_name
FROM region r, wine w
WHERE r.region_name = w.wine_name&quot;;

if ($regionName != &quot;ALL&quot;)
$query .= &quot; AND r.region_name = \&quot;$regionName\&quot;&quot;;

$query .=&quot; ORDER BY w.wine_name&quot;;

displayWineList($connection, $query, $regionName);

mysql_close($connection);
}
?>

</body>
</html>
 
[tt]<?=scriptName;?>[/tt]
should read
[tt]<?=$scriptName;?>[/tt]

//Daniel
 
My suggestion:
Try to clean up your HTML first.
All attributes in tags should be surronded by double quotes:

<input type=&quot;submit&quot; value=&quot;click this, a**shole&quot;>

This will already make a difference since you can exclude invalid HTML.

Question:
What is on line 42?
 
That's a mistake, DR. Copied code from a newsgroup and never changed the html. Whoops. Got the code working, though. Thanks all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top