Create link or form from MySQL data
Posted by: marija milojevic
Date: August 16, 2010 06:42AM

Hello,
I need help about something...
I made some HTML forms, using Java script dropdown menu:
When user select value in a dropdown, form fills with the data from MySQL db, based on a selected dropdown value...
It works great... But now I need function that will populate HTML form with MySQL values, based on a link value, without using dropdown...

Here is the code I've been using:

Javascr function:
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.redni_broj.options[form.redni_broj.options.selectedIndex].value;
self.location='pregled_radnih_naloga.php?redni_broj=' + val ;
}

</script>

Dropdown menu:
<?php
echo "<select name='ident' onchange=\"reload(this.form)\"><option value=''>Choose</option>";
while($noticia2 = mysql_fetch_array($quer2))
{
if($noticia2['ident']==@$ident)
{echo "<option selected value='$noticia2[ident]'>$noticia2[ident]</option>";}
else
{echo "<option value='$noticia2[ident]'>$noticia2[ident</option>";}

}
echo "</select>";
?>

Query:

<?php


$result = mysql_query("Select field from tbl where ident='$ident'")
or die(mysql_error());

while($row = mysql_fetch_array( $result ))
{

echo $row['field'] ;

}

?>


That worked, but if my link is my ident value, is there any way to select field from tbl, based on a $link....?

Any help will be appreciated!

Options: ReplyQuote


Subject
Written By
Posted
Create link or form from MySQL data
August 16, 2010 06:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.