Solved

Simple page - but Syntax Error

Posted on 2002-04-29
2
180 Views
Last Modified: 2006-11-17
I'm a newbie - spent about 2 hours looking for the reason I get:
 
Parse error: parse error in /home/ag/netafimusa-www/PHP/AddPet.php3 on line 34

for the page:

<html>
<head>
<title>Add Pet</title>
</head>
<body>
Catalog:<br>
<ul>

<?php
  $user="ag";
  $host="localhost";
  $password="";
  $database = "netafimusa_com";

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

$label_array = array ("LiteratureDescription" => "Literature Description");

//Loop through the values
foreach ($HTTP_POST_VARS as $key => $value)

//missing curly bracket

{
$query = "INSERT INTO tblLiteratureRequested
(LiteratureDescription) VALUES ('{$label_array["LiteratureDescription"]}');

                             

$result = mysql_query($query)
     or die ("Couldn't execute query.");

echo "The following pet has been added to the Pet
       Category: "$LiteratureDescription" ;

}
//Close the loop
?>
  <!-- Close your list and html -->
</ul>
</body>
</html>
0
Comment
Question by:aprillougheed
2 Comments
 
LVL 7

Accepted Solution

by:
axis_img earned 200 total points
Comment Utility
Would this be the problem?

echo "The following pet has been added to the Pet
      Category: "$LiteratureDescription" ;

should be:

echo "The following pet has been added to the Pet Category: $LiteratureDescription";

You have an extra quote in there...

Let me know if the problem persists...
Barry
0
 

Author Comment

by:aprillougheed
Comment Utility
I had found the error . . .  but thanks for your help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now