I need some help whit double switches..
i got this edit.php where i need to use url like this
edit.php?act=edit?id=1
this is what i had tryed but not working.. ?
$act = $_GET["act"];
$id = $_GET["id"];
$res = mysql_query("SELECT * FROM testi WHERE id = $id") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if ($act == "do_edit") {
$name = trim($_POST['name2']);
$kuvaus = trim($_POST['kuvaus']);
if (!$name || !$kuvaus)
stderr("Virhe", "Tietoja puuttuu!!");
$kokonimi = sqlesc($name);
$kuvailu = sqlesc($kuvaus);
mysql_query ("UPDATE testi SET nimi = '$kokonimi', kuvaus = '$kuvailu' WHERE id = $id") or sqlerr(__FILE__,__LINE__);
$returl = "edit.php?act=edit?id=$id";
header("Refresh: 0; url=$returl");
}
if ($act == "edit") {
?>
<div id="content">
<table border=1 cellspacing=0 cellpadding=5>
<form method=post action=edit.php?act=do_edit>
<tr><td>Nimi</td><td><input type=text name=name2 value=<?=$arr["nimi"]?> size=20></td></tr>
<tr><td>Kuvaus</td><td><input type=text name=kuvaus value=<?=$arr["kuvaus"]?> size=50></td></tr>
<tr><td colspan=2><input type=submit value='Muokkaa' class=btn></td></tr>
</form></table>
</div>
error what came up is this Notice: Undefined index: id in c:\public_html\edit.php and if i turn off error reporting page will not show..
Thanks for all help!
