0

Hi ...

I'm trying to make a drop down list box populated from a mysql table.

It all looks OK on the screen, but there is an error that I cant seem to fix.

The error is:

Notice: Undefined index: xxx in C:\Documents and Settings\GSW\My Documents\xxx\test.php on line 29

and the code is:

<?php


include("openatname.php");  // access database

$result= mysql_query("SELECT DISTINCT d_sec FROM domains WHERE d_genre LIKE 'family'");  // find records that include 'family' in the d_genre column.

$domainecho ="";    // put the form in an echo for easier positioning on an html page


$domainecho.="<form name='GetDomain' method='post'>";
$domainecho.="<select name=xxx size=12 style='width: 150px'>";



	while($row = mysql_fetch_array($result))
	{
	$y=$row['d_sec'];
$domainecho.="<option value=$y>$y</option>";
	}


$domainecho.="	</select>
		<input type=submit>
		</form>";

echo  $domainecho;      // this form output can be placed anywhere on page using <div>

$domain=$_POST['xxx'];

echo "<br><br><br>". $domain;

?>

Any ideas?
G-fer

2
Contributors
2
Replies
8
Views
7 Years
Discussion Span
Last Post by g-fer
0

Hi ...

I'm trying to make a drop down list box populated from a mysql table.

It all looks OK on the screen, but there is an error that I cant seem to fix.

The error is:

Notice: Undefined index: xxx in C:\Documents and Settings\GSW\My Documents\xxx\test.php on line 29

and the code is:

<?php


include("openatname.php");  // access database

$result= mysql_query("SELECT DISTINCT d_sec FROM domains WHERE d_genre LIKE 'family'");  // find records that include 'family' in the d_genre column.

$domainecho ="";    // put the form in an echo for easier positioning on an html page


$domainecho.="<form name='GetDomain' method='post'>";
$domainecho.="<select name=xxx size=12 style='width: 150px'>";



	while($row = mysql_fetch_array($result))
	{
	$y=$row['d_sec'];
$domainecho.="<option value=$y>$y</option>";
	}


$domainecho.="	</select>
		<input type=submit>
		</form>";

echo  $domainecho;      // this form output can be placed anywhere on page using <div>

$domain=$_POST['xxx'];

echo "<br><br><br>". $domain;

?>

Any ideas?
G-fer

:) hey there g-fer!

[give this a try] i hope this helps :

<?php


include("openatname.php");  // access database

$result= mysql_query("SELECT DISTINCT d_sec FROM domains WHERE d_genre LIKE 'family'");  // find records that include 'family' in the d_genre column.

$domainecho ="";    // put the form in an echo for easier positioning on an html page


$domainecho.="<for method='post'>"; // [ name='GetDomain'] attribute is removed [not really sure this affects but for less confusions though.  ~_^]
$domainecho.="<select name='xxx' size=12 style='width: 150px'>"; // and [name=xxx] added [' '] to it.



	while($row = mysql_fetch_array($result))
	{
	$y=$row['d_sec'];
$domainecho.="<option value=$y>$y</option>";
	}


$domainecho.="	</select>
		<input type=submit>
		</form>";

echo  $domainecho;      // this form output can be placed anywhere on page using <div>

$domain=$_POST['xxx'];

echo "<br><br><br>". $domain;

?>

great day ahead man! ~_^

0

Hmm...

Nup ... didn't make any difference.

I've just noticed that the error is actually a notice ... the selection echo's ok, (line 31) but I'm wondering if it will cause any problems later down the line

G-fer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.