Had this all working with html. Then I tried making it into html5 and I’m coding some of my first css code. The only thing I’m tackling right now is why isn’t my image showing?? I’m using google chrome btw. The code passed in the url is this: “?fname=raichu&yesorno=true%2F” And there is no image tag in my generated html :/ I’m assuming that the if statement is equating to false??
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
td{
text-align: center;
padding:15px;
background-color:black;
color:#00FF00;}
th{
background-color:black;
color:yellow}
</style>
<title>Search Results</title>
</head>
<body style="color:#FFFFFF">
<?php
$dbhost = 'server';
$dbname = 'database1';
$dbuser = 'me';
$dbpass = 'password';
$link = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
mysqli_select_db($link,$dbname);
$naame = $_GET["fname"];
if( $_GET["yesorno"] == 'true' OR !$_GET["yesorno"])
{$query = sprintf("SELECT image_url, Type
FROM Pokemon c
WHERE c.name='%s'", mysqli_real_escape_string($link,$naame));
$result = mysqli_fetch_assoc(mysqli_query($link,$query));
echo '<img height="450" width="330" src="'.$result['image_url'].'" alt="blue"/>';}
$res = mysqli_query($link,"SELECT Name,HP,Type,Pokedex_Number AS 'Pokedex Number',Weakness,Resistance,Retreat AS 'Retreat Cost'
FROM Pokemon
WHERE Pokedex_Number!=0 AND name='$naame'");
if (!$res) {
die("Query to show fields from table failed");}
$fields_num = mysqli_num_fields($res);
echo "<h1>Stats</h1>";
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{$field = mysqli_fetch_field($res);
echo "<th>{$field->name}</th>";}
echo "</tr>\n";
// printing table rows
while($row = mysqli_fetch_row($res))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
echo "</table>";
mysqli_close($link);
?>
<br />
<form method="link"
action = "http://engr.oregonstate.edu/~bainro/welcome.php" ><input
type="submit" value="(>O.O)>RETURN<(O.O<)"></form>
<p></p>
</body>
</html>
The variable you are retrieving from the url, is never evaluating to true because ‘%2F’ is a forward slash. Check your code.