Hi there, this is my virgin post in PHP Freaks, and i do hope you'll treat me real nice
Anyway!
I have come across a problem with some coding work that i am doing. My problem is the following:
Presenters in the radio station, are shown in order of ID.
What i want to be able to do, is edit the order in which they are shown, by editing the ID.
My problem, is that when i process the form the script has no way of telling what the field names are, as they are not pre defined, because i have put the code in a while loop, to get all of the DJ's names & id's out.
My code is below:
<?
$query = "SELECT * FROM profiles ORDER BY ID DESC";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
?>
<form method="post" action="viewpage.php?page_id=15">
<table align="center">
<tr>
<td align="right">DJ Name:</td>
<td><input name="name_<?php echo $row['ID']; ?>" type="text" id="<?php echo $row['ID']; ?>" value="<?php echo $row['djname']; ?>" size="40" maxlength="250" /></td></tr>
<tr>
<td align="right">Order:</td>
<td><input name="id" type="text" id="djname" value="<?php echo $row['ID']; ?>" size="40" maxlength="250" /></td></tr>
<tr><td> </td><td><input type="submit" name="submit" value="Modify" />
<input type="submit" name="Submit" value="Delete" /><input type="hidden" name="id" value="<?php echo $row['djname']; ?>" /></td></tr>
</table>
</form>
<br><br><br><br>
<?php
}
?>
So as you can see, it displays the DJ's by ID decending.
I need to be able to:
Edit all of the ID's to correspond to the order that i set (so myseld as id 1, my co-presenter as id 2 and so on)
So if i submit the form with the buttons that are allready there, then it will only recognise the change to that specific form, rather than all the forms that are displayed.
And thats about it!
I hope i have made myself clear, i have tried to explain it well, but seeing as i don't really understand it myself, i won't have done that well.
Can i request that when people reply they don't say like "oh google this: " or somthing like that, because when i do google things like that i just get more and more confused!
Argh!
So if someone could be fantastic and maybe give me the code, then i would be willing to donate maybe $20 to PHP Freaks or somthing like that.
But thanks very much for reading, and i hope you can awnser my question!
Cheers!
Base