Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need Help with Script
Old 07-15-2005, 11:12 PM Need Help with Script
Average Talker

Posts: 19
Trades: 0
I'm getting this error:
"Parse error: parse error, unexpected '[', expecting T_VARIABLE or '$' in /home/deanirw/public_html/kitchen/index.php on line 37".


Script by Enigmatic
PHP Code:
<?php

/*server & db connection variables*/ 

$dbhost 'localhost'
$dbuser 'deanirw_kitchen'
$dbpass '*****'
$dbname 'deanirw_kitchen'

/*server connection*/ 

$connect mysql_connect("$dbhost""$dbuser""$dbpass"
or die (
"Could not connect to server :" mysql_error()); 

/*db select*/ 

$db mysql_select_db("$dbname"$connect
or die (
"Could not select db :" mysql_error()); 

/*insert data variable declaration*/ 

$insertFormName $_POST['insertName']; 
$inserFormLocation $_POST['insertLocation']; 
$inserFormPhone $_POST['insertPhone']; 
$inserFormCatagory $_POST['insertCatagory']; 
$inserFormBusiness_name $_POST['insertBusiness_name']; 

$insertName trim($inserFormName); 
$insertLocation trim($inserFormLocation); 
$insertPhone trim($inserFormPhone); 
$insertCatagory trim($inserFormCatagory); 
$insertBusiness_name trim($inserFormBusiness_name); 


/*insert data sql*/ 

if(isset (['insert_form']) ) { 
$insert mysql_query("INSERT INTO company_info (id, name, location, phone, catagorie, business_name) VALUES ('', '$inserName', '$insertLocation', '$insertPhone', '$insertCatagorie', '$insertBusiness_name')"
or die (
"Could not insert new data :" mysql_error()); 
} else { 
echo 
"All fields are required to be completed !! <br />"


?>

<html>
<head>
<title>Search my badass website !!</title>
<style type="text/css">
.text
  {
   font-family:Verdana, Arial, Helvetica, sans-serif;
   font-size:10;
   font-weight:normal;
   color:#000000;
  }
.inputField
  {
font-family:Verdana, Arial, Helvetica, sans-serif;
color:#000000;
font-size:10px;
font-wieght:normal;
border-color:#666666;
border-width:1px;
border-style:solid;
width:150px;
height:17px;
  }
.button 
  {
   font-family:Verdana, Arial, Helvetica, sans-serif;
   font-size:10;
   color:#000000;
   height:17px;
   width:50px;
   border-color:#666666;
   border-width:1px;
   background-color:#CCCCCC;
  }
</style>
</head>
<body>
<form name="insert_form" action="<?php echo $_SERVER['PHP_SELF'?>">
<table>
  <tr>
    <td class="text"><u>Insert Company Information Form</u></td>
  </tr>
</table>
<table>
  <tr>
    <td class="text" valign="middle" align="right">Name : </td>
    <td valign="middle">
    <input type="text" class="inputField" name="insertName" size="20"></td>
  </tr>
  <br />
  <tr>
    <td class="text" valign="middle" align="right">Location : </td>
    <td valign="middle">
    <input type="text" class="inputField" name="insertLocation" size="20"></td>
  </tr>
  <tr>
    <td class="text" valign="middle" align="right">Phone : </td>
    <td valign="middle">
    <input type="text" class="inputField" name="insertPhone" size="20"></td>
  </tr>
  <tr>
    <td class="text" valign="middle" align="right">Category : </td>
    <td valign="middle">
    <input type="text" class="inputField" name="insertCatagory" size="20"></td>
  </tr>
  <tr>
    <td class="text" valign="middle" align="right">Business Name : </td>
    <td valign="middle">
    <input type="text" class="inputField" name="insertBusiness_name" size="20"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right"><input type="reset" value="Clear" class="button"> <input type="submit" value="Insert" class="button"></td>
  </tr>
</table>
</form>
</body>
</html>
deanirw is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-15-2005, 11:20 PM
Unknown.

Posts: 1,693
Trades: 0
The problem is this line..
PHP Code:
if(isset (['insert_form']) ) { 
its not valid php.

It looks like you are trying to make sure none of the fields are empty.. so instead replace that line with..
PHP Code:
if($insertFormName || $inserFormLocation || $inserFormPhone || $inserFormCatagory || $inserFormBusiness_name) { 
that will fix there error.. although you might want to do some more advanced validation.. such as making sure that what the user enters is longer or equal to a certain length for example.
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 07-15-2005, 11:32 PM
Average Talker

Posts: 19
Trades: 0
How do I make it "When forum submits, save mysql".
deanirw is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need Help with Script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18776 seconds with 12 queries