Parse error: parse error, unexpected T_STRING on line 40

Reply

Join Date: Aug 2008
Posts: 10
Reputation: wiccanwolf is an unknown quantity at this point 
Solved Threads: 0
wiccanwolf wiccanwolf is offline Offline
Newbie Poster

Re: Parse error: parse error, unexpected T_STRING on line 40

 
0
  #21
Aug 12th, 2008
Yay! It works now! <333 Thanks for your help, everyone! =)

But... what is an undefined index? o.O; Because now it's giving me that as a notice. Does that just mean it's going to give me that because I don't have any information for the database?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: Parse error: parse error, unexpected T_STRING on line 40

 
0
  #22
Aug 12th, 2008
I'm not sure where that error is coming from ... is it a mysql error message?

It could be from the connect.php included file, or it could be caused by the database table structure (?maybe) ... have you got anymore info on that error?

The first thing that popped to mind was you need to pass NULL to the database table for the table unique key iterator to populate that key field, if a default value is not set for that field ... but that's just a wild guess.

:-)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 39
Reputation: god_1896 is an unknown quantity at this point 
Solved Threads: 0
god_1896 god_1896 is offline Offline
Light Poster

Re: Parse error: parse error, unexpected T_STRING on line 40

 
0
  #23
Aug 12th, 2008
try this code; gope this can help you, that's power only i got. im newbie in php to,

<?php
include ('connect.php');
?>

<form name="form1" method="post" action="dogstore.php">
Dog's Name:
<input name="dogname" type="text">
<br>
Dog's Breed:
<select name="dogbreed">
<option value="breed1">Breed</option>
<option value="breed2">Breed</option>
<option value="breed3">Breed</option>
<option value="breed4">Breed</option>
<option value="breed5">Breed</option>
<option value="breed6">Breed</option>
<option value="breed7">Breed</option>
</select>
<br>
Dog's Gender:
<select name="doggender">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<br>
<input type="submit" name="Submit" value="Buy Dog">
</form>

<?php
//trim removes the white spaces from the beginning and end of the text
$dogname = trim($_POST['dogname']);
$dogbreed = trim($_POST['dogbreed']);
$doggender = trim($_POST['doggender']);

//Make sure the name form is filled out.
if (isset($_POST['dogname'])) {
echo "good";
}
else {

echo "Oops! You forgot to fill in the name!";
}

$ownerid = $_SESSION['id'];

if (!isset($_POST['Buy Dog'])) {
echo "Congratulations! You've purchased a dog.";
}
else {
echo "Congratulations! You've purchased a dog.";
}
$dog = @mysql_query("INSERT INTO dogs (ownerid, dogname, dogbreed, doggender)
VALUES ('$ownerid', '$dogname', '$doggender')") or die("Error:
".mysql_error());
?>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC