| | |
Parse error: parse error, unexpected T_STRING on line 40
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
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.
:-)
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.
:-)
•
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
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());
?>
<?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());
?>
![]() |
Similar Threads
- Parse error: syntax error, unexpected T_STRING (PHP)
- parse error, unexpected T_STRING in (PHP)
- Parse error: parse error, unexpected T_STRING on line 12 (PHP)
- Please Help! parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING (PHP)
- PHP Parse error: parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING in /home/thei2k9/public_html/includes/f (PHP)
- Need Help With Parse Error... (PHP)
Other Threads in the PHP Forum
- Previous Thread: $_POST value with <a> link click
- Next Thread: Trying to commad a script based on timing! But it doesnt work. Please help?
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube





