strong-storm Posted March 13, 2005 Report Posted March 13, 2005 Kā ar php nočekot kura poga nospiesta action formaa?
Kavacky Posted March 13, 2005 Report Posted March 13, 2005 Uz nospiešanu pārlādē lapu, padod kādu parametru ar datiem par pogu stāvokli. Tad apstrādā un noskaidrosi, kas ir ticis nospiests. Tas, ko tu domā: Ar PHP to izdarīt nevar, tam ir JavaScripts.
strong-storm Posted March 13, 2005 Author Report Posted March 13, 2005 Lieta taada, ka man vajag 2 pogas submit un delete vinjas abas nevar apvienot 1 action formaa tip delete - do.php?id=delete submit do.php?id=pievienot ?
kirils Posted March 13, 2005 Report Posted March 13, 2005 if ($_A['B']=='C') echo ('poga B nospiesta'); if ($_A['D']=='E') echo ('poga D nospiesta'); if ($_A['F']=='G') echo ('poga F nospiesta'); if ($_A['H']=='I') echo ('poga H nospiesta'); kur A = formas metode, B, D, F, H = pogu vaardi C, E, G, I = attieciigaas pogu veertiibas. luudzu, izlasi vismaz ievada nodalju php manuaali.
bubu Posted March 13, 2005 Report Posted March 13, 2005 (edited) Lieta taada, ka man vajag 2 pogas submit un delete vinjas abas nevar apvienot 1 action formaa tip delete - do.php?id=delete submit do.php?id=pievienot ? 14975[/snapback] Vai tad nezini, ko dara name parametrs formas kontroļiem? <form action="do.php" method="get"> ... <input type="submit" name="id" value="delete">Dzēst</input> <input type="submit" name="id" value="pievienot">Pievienot</input> </form> Tagad tev būs $_GET['id'] = ar vai nu delete vai pievienot. Edited March 13, 2005 by bubu
Venom Posted March 14, 2005 Report Posted March 14, 2005 /me lieto <input type="submit" name="delete" value="dzēst" /> <input type="submit" name="add" value="pievienot" /> un att. pārbauda if (isset($_POST['delete'])), jo value var būt dažādās valodās (Dzēst=Delete=Стереть=Loeschen utt).
rudzis Posted March 14, 2005 Report Posted March 14, 2005 Piekrītu Venom variantam. Pats tā arī parasti daru.
Recommended Posts