Solved

Simple page - but Syntax Error

Posted on 2002-04-29
2
181 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
ID: 6978968
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
ID: 6978984
I had found the error . . .  but thanks for your help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 38
str_replace not working in php script 4 30
echo paypal data on screen 5 50
How can I make this form submit to itself? 10 27
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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

773 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