Select from table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ccjob2
Forum Newbie
Posts: 16
Joined: Tue Jun 04, 2002 9:37 am

Select from table

Post by ccjob2 »

Hi,
Is there a way to populate a select tag, in an insert form, with table content ? And if it's possible, how can I insert into new table, into specific field, the selection I made ?

Thanks
Carlo
User avatar
riley
Forum Commoner
Posts: 45
Joined: Thu May 02, 2002 6:31 pm

Post by riley »

I hope this is what you are looking for!

Code: Select all

$Mp2SomResult = MSSQL_QUERY($query);
$number = MSSQL_NUM_ROWS($Mp2SomResult);

Code: Select all

<Select Name='Location'>
	<Option></Option>
	<?
	$i=0;
	if ($number > 0) :
		while ($i < $number) :
			$Location = mssql_result($Mp2SomResult,$i,"Location");
			print "<Option Value='$Location'>$Location</Option>";
			$i++;
		endwhile;
	endif;
	?>
</Select>
ccjob2
Forum Newbie
Posts: 16
Joined: Tue Jun 04, 2002 9:37 am

I think of yes

Post by ccjob2 »

Thanks,
I asked for MySQL solution, but I think is the same way ... I asked also how to insert info from select variable (in your case $Location) to MySQL field destination.
For example if I use a table:
ID
Location
How can I insert Location content ?

Thanks

Carlo
Post Reply