Thank you everyone for the great responses.

Does anyone know of a good link for learning about filtering MySQL queries? I don't expect anyone to explain it on here, but a link to a good resource would be very handy. Or if anyone knows of a good book that explains some of the basic elements of PHP and MySQL. I'm open to any suggestions.

Thank you everyone for the tips and suggestions. I'll +1 each one when I'm back at my computer. BTW, I'm still learning php and MySQL but what is the reason behind giving a var to each value? Is there a good resource online that explains this?

Thanks again. I really appreciate the help.

I am currently working on a simple survey system for educational purposes. I know it is subject to SQL Injection, but I am new to PHP/MySQL and wanted to learn something basic so I have something to build upon later.

Basically, I have an HTML form that processes the PHP on the same page:

<form action="" method="post">
Please enter your first name: <input type="text" name="first_name" size="40" /><br /><br /> 
Please enter your last name: <input type="text" name="last_name" size="40" /><br /><br /> 
A number where you can be reached: <input type="text" name="phone" size="15" /><br /><br />

Was your technical issue resolved? <select name="resolved"><option selected="selected" value="">Select One...</option><option value="yes">Yes</option><option value="no">No</option></select><br /><br /> 

On a scale of 1 - 5, was your technician knowledgeable?<br /> <select name="knowledge"><option selected="selected" value="">Select One...</option><option value="1">1 - The technician was not knowledgeable at all</option><option value="2">2 - The technician was somewhat knowledgeable</option><option value="3">3 - The technician met my standards</option><option value="4">4 - The technician was knowledgeable</option><option value="5">5 - The technician was very knowledgeable</option></select><br /><br /> 

On a scale of 1 - 5, was your technician friendly?<br /><select name="friendly"> <option selected="selected" value="">Select One...</option><option value="1">1 - The technician was not friendly at all</option><option value="2">2 - The technician was somewhat friendly</option><option value="3">3 - The technician met my standards</option><option value="4">4 - The technician was friendly</option><option value="5">5 - The technician was very friendly</option></select><br /><br /> 

On a scale of 1 - 5, was your issue quickly resolved?<br /> <select name="quickness"> <option selected="selected" value="">Select One...</option><option value="1">1 - The issue was not resolved quickly at all</option><option value="2">2 - ...

This appears to be a problem with my template and Joomla, not necessarily a problem with my code. I will still definitely try to get my code organized into an array, however. Always willing to learn more. :)

Meanwhile, I scoot over to RocketTheme's website to see what they suggest. Thanks again everyone for your help.

Thanks for the suggestions. I changed to code to what dschuett had stated, and I get error messages, but the data still writes to the database. I think what is happening here is a conflict with the template I am using. The error messages state the following:

Warning: Invalid argument supplied for foreach() in /myserver/public_html/demo/libraries/gantry/core/gantrytemplate.class.php on line 537

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /myserver/public_html/demo/libraries/gantry/core/gantrytemplate.class.php on line 508

Warning: Invalid argument supplied for foreach() in /myserver/public_html/demo/modules/mod_roknavmenu/lib/RokNavMenu.php on line 72

Fatal error: Call to a member function getDefaults() on a non-object in /myserver/public_html/demo/modules/mod_roknavmenu/lib/librokmenu/RokMenu.php on line 64

I'm using a template from RocketTheme, and I think these errors are conflicting with something else in their code as well. Perhaps I will rework the code into an array as you suggested, veedeo, and see if it makes a difference.

Thanks for the suggestions everyone. I appreciate it.

I am new to PHP/MySQL and currently working on a project to learn it a little better. I have a bit of PHP code and it has a problem that I'm having a little trouble figuring out.

Basically, it is taking session data and writing it to a MySQL database. Here is the entire code:

<?php

$con = mysql_connect("localhost","my_username","mypassword");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("myserver_imaging", $con);

mysql_query ("INSERT INTO imaging (os,MAC,Model,AntiVirus,Browser,Email,Connectivity,Sound,Ports) VALUES ('".$_SESSION['imaging2']."','".$_SESSION['imaging3']."','".$_SESSION['imaging4']."','".$_SESSION['antivirus']."','".$_SESSION['browser']."','".$_SESSION['email']."','".$_SESSION['connectivity']."','".$_SESSION['sound']."','".$_SESSION['ports']."')");
OR die("Could not update: ".mysql_error());

mysql_close($con);
?>

Now here's the problem. When I remove line 12 (the OR die statement), the data gets written to the database, but it errors out. I'm using Joomla 2.5 with the Sourcerer plug-in to insert PHP into my pages, and the error messages point directly to a couple modules in my template.

When I add the statement back in, the page redirects where it is supposed to, but the data doesn't get written to the database.

I know this question would best be directed to those using Joomla, but I'm also curious to know if there is a problem with my syntax in line 12. This isn't a huge deal since it is only a project, but I would still like to know if the problem is with my syntax.

Any suggestions or comments would be very much appreciated! Thanks for checking into it with me.