griffinwebnet
07-20-2011, 04:23 PM
Ello All,
I am trying to write an app that acts as a booking system for my dj company, i have a form for new events that inserts the data into a mySQL database. then i have a table that lists all the events on a different page. in that table i have an 'Edit Event' button next to each entry. what i need to do is when i click that button, it will load a form identical to the 'new event' form but populated with the values for that event.
to populate the form i figured id use a script like this:
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM field");
while($row = mysql_fetch_array($result))
{
echo '<form action="">';
echo '<input type="text" name="client_name" value=".$row['cli-name']">';
///Etc, Etc, Etc.
echo '</form>';
}
mysql_close($con);
?>
what i dont know is 2 things, how to select the row using that button, and how to set up a select as i have many values to choose from in the select, but how do i make the one in the database the selected one?:confused:
Thanks in Advance,
Your help is much appreciated.
-JL Griffin
I am trying to write an app that acts as a booking system for my dj company, i have a form for new events that inserts the data into a mySQL database. then i have a table that lists all the events on a different page. in that table i have an 'Edit Event' button next to each entry. what i need to do is when i click that button, it will load a form identical to the 'new event' form but populated with the values for that event.
to populate the form i figured id use a script like this:
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM field");
while($row = mysql_fetch_array($result))
{
echo '<form action="">';
echo '<input type="text" name="client_name" value=".$row['cli-name']">';
///Etc, Etc, Etc.
echo '</form>';
}
mysql_close($con);
?>
what i dont know is 2 things, how to select the row using that button, and how to set up a select as i have many values to choose from in the select, but how do i make the one in the database the selected one?:confused:
Thanks in Advance,
Your help is much appreciated.
-JL Griffin