Form help

I’m trying to create a form where I can submit info that will go into my database. My problem here is that it picks out the carmake but in my case because I have Honda more than once it comes up more than once.

IE the O is a check mark in the web site

O Ford O Honda OHonda O Honda ( I just want Honda all carmakes to come up once)

<?php ?> Car Makes <?php include(""); $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");

/* gets pet types from PCarMake table in alphabetical order */
$query = “SELECT CarMake FROM ALL_ITEMS ORDER BY CarMake”; // 21
$result = mysql_query($query)
or die (“Couldn’t execute query.”);

/* Display text before form */
echo "

Select the category for the pet you are adding.

If you are adding a pet in a category that is not listed, choose New Category and type the name and description of the category. Press Submit Category when you have finished selecting an existing category or typing a new category.n";

/* Create form containing selection list */
echo “n”;
echo “

echo “”;
$counter=0; // 38
while ($row = mysql_fetch_array($result)) // 39
echo "n”; // 48
$counter++; // 49
echo “

<input type=‘radio’ name=‘category’ value=’$CarMake’"; // 43
if ($counter == 0) // 44
echo “checked”;
echo “>$CarMake

include(“”); // 53

echo “

echo “n”;

Have you tried using DISTINCT?


This should prevent rows being fetched that have the same name.

Thanks the Distinc function worked, so now I have to try to get the rest of it to work.

Sponsor our Newsletter | Privacy Policy | Terms of Service