943,907 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2291
  • PHP RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Aug 12th, 2008
0

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

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wiccanwolf is offline Offline
10 posts
since Aug 2008
Aug 12th, 2008
0

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

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.

:-)
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008
Aug 12th, 2008
0

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

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());
?>
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: $_POST value with <a> link click
Next Thread in PHP Forum Timeline: Trying to commad a script based on timing! But it doesnt work. Please help?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC