Hi,
I need to create an admin tool that will update fields in a table. Basically, I need it to do a few things.
1) Display a list of ID numbers in a pull-down menu (This is currently working)
2) I than need it to update three fields in a table. I need to add data to these fields. I am not sure how to structure a query around this. My previous scripts have all been search scripts. Fairly easy....this one is new territory and I could use some help.
My script so far is this:
<?
$username="xxx";
$password="xxx";
$database="xxx";
mysql_pconnect('xxx',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
// Below will display listings for specific ID///
mysql_query("CREATE TEMPORARY TABLE temp_featured select Id from residential where lister_office_name='Town & Country Realty'");
mysql_query("INSERT INTO temp_featured select Id from multi where lister_office_name='Town & Country Realty'");
mysql_query("INSERT INTO temp_featured select Id from mobile where lister_office_name='Town & Country Realty'");
mysql_query("INSERT INTO temp_featured select Id from land where lister_office_name='Town & Country Realty'");
mysql_query("INSERT INTO temp_featured select Id from condo where lister_office_name='Town & Country Realty'");
mysql_query("INSERT INTO temp_featured select Id from commercial where lister_office_name='Town & Country Realty'");
$query="SELECT * FROM temp_featured";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_numrows($result);
?>
<form method="POST" action="featured_script.php">
<table width="100%">
<tr>
<td width="22%">Select MLS to edit</td>
<td width="1%"> </td>
<td width="77%"><select size="1" name="featuredid">
<?
while ($row = mysql_fetch_array($result)) // this will grab the results from query
{
?>
<option value="<? echo $row[Id]; ?>"><? echo $row[Id] ;?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td width="22%">Is this a featured listing?</td>
<td width="1%"> </td>
<td width="77%">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><input type="radio" value="yes" checked name="featured_yn">Yes</td>
<td width="50%"><input type="radio" name="featured_yn" value="no">no</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="22%"> </td>
<td width="1%"> </td>
<td width="77%"> </td>
</tr>
<tr>
<td width="22%">Agents Comments:</td>
<td width="1%"> </td>
<td width="77%"><textarea rows="5" name="agent_comment" cols="39"></textarea></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
How would you approach this script. Basically, I need the form to update two fields based on the Id number. Notice that the form action I have specified as NOT_SURE!!!!!
This is because I am used to having the form goto another script that takes the variables and processes the query. It seems to me that this script should be self contained.
Not sure what to do.....any help would be greatly appreciated.
If I havent given you enough details....please ask me questions.