salukigirl
New Member
- Messages
- 78
- Reaction score
- 0
- Points
- 0
Ok, long story short I'v having trouble with my output. It output's well.... nothing....
This is the pet store page. It creates the animal the user wants. When it is done it is to store the bought pet at the owner's home page. But for some reason it doesn't show up.....
Am I like missing a huge chunk of code? or???
Here are the scripts I built...
This is the Home page. I want it to display the animal the user just bought.
This is the pet store page. It creates the animal the user wants. When it is done it is to store the bought pet at the owner's home page. But for some reason it doesn't show up.....
Am I like missing a huge chunk of code? or???
Here are the scripts I built...
PHP:
<?php
include ('connect.php');
?>
<form name="form1" method="post" action="petstore.php">
Registered Name:
<br>
<input name="petname" type="text"
Rabbit Breed:
<select breed="petbreed"
<option value="American Chinchilla">American Chinchilla</option>
<option value"American Fuzzy Lop">American Fuzzy Lop</option>
<option value"American Sable">American Sable</option>
<option value"Belgian Hare">Belgian Hare</option>
<option value"Brittania Petite">Brittania Petite</option>
<option value"Californian">Californian</option>
<option value"Champagne D'Argent"> Champagne D'Argent </option>
<option value"Checkered Giant">Checkered Giant</option>
<option value"Cinnamon">Cinnamon</option>
<option value"Creme D'Argent">Creme D'Argent</option>
<option value"Dutch">Dutch</option>
<option value"Dwarf Hotot">Dwarf Hotot</option>
<option value"English Angora">English Angora</option>
<option value"English Spot">English Spot</option>
<option value"Flemish Giant">Flemish Giant</option>
<option value"Florida White ">Florida White </option>
<option value"Giant Angora">Giant Angora</option>
<option value"Giant Chinchilla ">Giant Chinchilla </option>
<option value"French Angora">French Angora</option>
<option value"Harlequin">Harlequin</option>
<option value"Havana">Havana</option>
<option value"Himalayan">Himalayan</option>
<option value"Holland Lop">Holland Lop</option>
<option value"Hotot">Hotot</option>
<option value"Mini Rex">Mini Rex</option>
<option value"Rex">Rex</option>
<option value"Satin Angora">Satin Angora</option>
<option value"Standard Chinchilla ">Standard Chinchilla </option>
<br>
pet gender:
<select name"petgender">
<option value"male">Male</option>
<option value"female">Female</option>
<br>
Pet Color:
<select name"petcolor">
<option value"white">White</option>
<option value"black">Black</option>
<option value"gray">Gray</option>
<br>
</select>
<input type="submit" name="submit" value="But It!">
</form>
<?php
$petname = trim($_POST['petname']);
$petbreed = trim($_POST['petbreed']);
$petgender = trim($_POST['petgender']);
$petcolor = trim($_POST['petcolor']);
?>
<?php
$ownerid =$_SESSION['id']
?>
<?php
$pet =@mysql_query("INSERT INTO pets (ownerid, petname, petbreed, petgender, petcolor)
VALUES ('$ownerid', '$petname', '$petbreed', '$petgender', '$petcolor')") or die ("error:".mysql_error())
?>
This is the Home page. I want it to display the animal the user just bought.
PHP:
<?php
include('connect.php');
?>
<?php
$query="SELECT petname, petbreed, petgender, petcolor FROM pets WHERE ownerid=".$_SESSION['id']."";
$result = mysql_query ($query)
or die ("couldn't execute query.");
?>
<?php
while ($pet= mysql_fetch_object ($result))
{
?>
<?php
echo
"
Registered Name: $petname
<br>
Breed: $petbreed
<br>
Gender: $petgender
<br>
Color: $petcolor
<br><br>
";
?>
<?php
}
?>