Hi all,
This is my first post and first attempt at PHP so sorry if this sounds daft. I'm about a fifth of the way through the php bible and a quarter through php/mysql for dummies, so it can only get better.
Anyway I'm getting this error when I try to run a form which takes the data from the form fields and inserts it into a mysql database I set up on my hosting account.
Parse error: parse error, unexpected T_STRING, expecting ']' in /home/peilife/public_html/phpform.php on line 32
Here's the code:
<HTML>
<HEAD>
<TITLE>PHP Form submit</TITLE>
<META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004">
</HEAD>
<BODY>
<form action="<?php echo $SERVER?>" method="post">
">
<p> Please enter the name of the business: <BR>
<input type="text" name="$busname" size=40 value="<?php echo $PHP_SELF?>">
<p> Please enter the phone number of the business: <BR>
<input type="text" name="$busphone" size=40 value="<?php echo $PHP_SELF?>">
<p> Please enter the primary key: <BR>
<input type="text" name="$primkey" size=40 value="<?php echo $PHP_SELF?>">
<p> Please enter the image location where the business image is stored: <BR>
<input type="text" name="$imageloc" size=40 value="<?php echo $PHP_SELF?>"> <BR>
<input type="submit" value="submit"><input type="reset" value="clear values">
<?php
$user = "peilife_admin";
$host = "localhost";
$password = "*******";
$database = "peilife_busdir"
$connection = mysql_connect($host, $user, $password) or die ("Could not make connection to server");
**line 32**mysql_select_db ('peilife_admin') or die ("Couldn't select database");
$query1 = "INSERT INTO name(busname) VALUES ($busname)"
$query2 = "INSERT INTO phone(busphone) VALUES ($busphone)"
$query3 = "INSERT INTO primary(primkey) VALUES ($primkey)"
$query4 = "INSERT INTO images(imageloc) VALUES ($imageloc)"
$result1 = mysql_query($query1);
$result2 = mysql_query($query2);
$result3 = mysql_query($query3);
$result4 = mysql_query($query4);
echo "Record updated";
?>
</BODY>
</HTML>
I just added line 32 there to show where its going wrong. I've been googling for a while trying to find a solution but I can't figure it out. I'd be really grateful if anyone could help.
Thanks
Andy Seaton