Posted by Otto on 10/11/05 22:08
Hello Stefan
> <?php
>
> print('<a href="next.htm">next</a><a href="prev.htm">previous</a><a
> href="new.htm">new</a><a href="delete.htm">delete</a>');
>
> ?>
>
I don't have problem with this. I'm looking for a good sample with
PHP & MySQL source for the mentioned buttons.
I already did it for the new save and delete button but have some
problem with next and previous. It would be nice if I could get all in
one script!
Someting like that:
// new record
if($mode == "new")
{
$query = "INSERT INTO ...";
$req = mysql_query($query);
$id = mysql_insert_id();
}
// save record
if($mode == "save")
{
$id = $last_id;
$query = "UPDATE ....
$req = mysql_query($query);
}
// Delete record
if($mode == "Delete")
{
$id = DeleteEnr($last_id, $famille);
$query = "DELETE FROM adresse WHERE ID=$id";
$req = mysql_query($query);
}
// Next record
if($mode == "next")
{
}
// Previous record
if($mode == "previous")
{
}
// Check passed ID
if ($ID && !$id){$id = $ID;}
// Query ID
$query = "SELECT FROM .. WHERE ID=$id order by name";
$req = mysql_query($query);
// Form
?>
Form top
...
...
...
...
Form bottom
Button on the bottom of the screen
<input type='submit' name=mode value='next'>
<input type='submit' name=mode value='previous'>
<input type='submit' name=mode value='save'>
<input type='submit' name=mode value='delete'>
<input type=hidden name=last_id value='<?= $id ?>'>
</form>
</body></html>
Do you think that's possible ?
Regards
Otto
[Back to original message]
|