sirup_segar Posted January 26, 2008 Share Posted January 26, 2008 hi,nice to be here again.i think i will often be here hehe i have a form like this <form method='post' action='shop_action.php' name='frmshopaction'> <table align='center' width='650' class='mytable'> <tr> --<tr declaration>-- </tr> "; for ($i=0;$i<$hitung;$i++) { $tmpisbn=$isbnx[$i]; $tmpjdul=$judulx[$i]; $tmppen=$penerbitx[$i]; $tmppeng=$pengarangx[$i]; $tmpqty=$qtyx[$i]; $tmphrg=$hrgx[$i]; $tmphrgtot=$hrg_qtyx[$i]; $hrgrp=tampilrupiah($tmphrg); $hrgtot=tampilrupiah($tmphrgtot); $pricerp=tampilrupiah($price); echo "<tr> <td>$tmpisbn</td> <td>$tmpjdul</td> <td>$tmppen</td> <td>$tmppeng</td> <td>$hrgrp</td> <td><input type='text' name='txt_qty[$i]' id='txt_qty[$i]' value='$tmpqty' size='1'></td> <td>$hrgtot</td> </tr> "; } </table>"; echo "<table align='center'> <tr> <td> <input type='image' src='../image/lihat-katalog.gif' width='150' height='40' name='show'> <input type='image' src='../image/update-qty.gif' height='40' width='150' name='edit'> <input type='image' src='../image/selesai-belanja.gif' width='150' height='40' name='chekout'></td> </tr> </table> </form> and my shop_action.php is below if (isset($_POST["edit"])) { --still working on Edit-- } else if (isset($_POST["show"])) { --still working on show too-- } else if (isset($_POST["chekout"])) { --also,still working on checkout-- when i clik one of my images on frmshopaction,none of my shop_action.php is done. anybody can give me an idea? thanks alot.. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/ Share on other sites More sharing options...
revraz Posted January 26, 2008 Share Posted January 26, 2008 Change the input type to submit and change it to a Image with CSS. This is a HTML issue, not PHP. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-449557 Share on other sites More sharing options...
AndyB Posted January 26, 2008 Share Posted January 26, 2008 if (isset($_POST["edit_x"])) and similarly for the other input images is what works. Clicking the image returns the coordinate values of the click relative to the image upper-left corner, i.e. $_POST[inputname_x'] and $_POST['inputname_y']. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-449560 Share on other sites More sharing options...
sirup_segar Posted January 28, 2008 Author Share Posted January 28, 2008 to andy, yes you're totally right.when i change my form method into 'get', in the address bar i saw weird parameter, like ' http://localhost/pim_update/pengunjung/shop_action.php?txt_qty%5B0%5D=70&txt_qty%5B1%5D=140&lihatkat.x=53&lihatkat.y=20 ' of course i'm confused about what's happen .by the way, i have to change my input type=image's name into 'show_x' and 'show_y', 'edit_x' and 'edit_y', and also 'checkout_x' and 'checkout_y'? or replace the '_x' and 'show_y' with some number? because the value of '_x' and '_y' always changed. thanks a lot bro.. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451002 Share on other sites More sharing options...
mmarif4u Posted January 28, 2008 Share Posted January 28, 2008 I dont think you have to change your images name to _x and _y.Just change if (isset($_POST["edit_x"])).As andy mention above.Dont change image name or button name. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451004 Share on other sites More sharing options...
sirup_segar Posted January 28, 2008 Author Share Posted January 28, 2008 mr mmarif4u,i have changed my code if (isset($_POST["edit_x"])) { echo "<script language='javascript'> alert('you are edited'); </script>"; } but nothing shows up when i click on the edit image... ??? Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451015 Share on other sites More sharing options...
mmarif4u Posted January 28, 2008 Share Posted January 28, 2008 Try this: if (isset($_POST["edit_x"])) { echo "you are edited"; } Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451017 Share on other sites More sharing options...
PFMaBiSmAd Posted January 28, 2008 Share Posted January 28, 2008 Also, did you change the form method back to post? Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451020 Share on other sites More sharing options...
sirup_segar Posted January 28, 2008 Author Share Posted January 28, 2008 for mr PFMaBiSmAd, sorry the answer is no,i didn't change back my form method to post. but i have now, and it worked.thanks a lot. for mr mmarif4u, thanks for the snippet..it's because i haven't change back the method into post.. . by the way, how can i add the "topic solved" flag to my thread?? Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451022 Share on other sites More sharing options...
mmarif4u Posted January 28, 2008 Share Posted January 28, 2008 Glad that you sorted it out. In the forum Bottom menu just click Topic solved button. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451024 Share on other sites More sharing options...
sirup_segar Posted January 28, 2008 Author Share Posted January 28, 2008 ehmm, by the way again, can we use use multiple header("Location:some_location.php") in some if-else syntax?so there aren't error Warning: Cannot add header information - headers already sent by ? thanks again...i'll give "topics solved" after this thread... thanks;D Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451027 Share on other sites More sharing options...
sirup_segar Posted January 28, 2008 Author Share Posted January 28, 2008 i think i'll put "Topics Solved" now..hehe thanks for everyone.. Quote Link to comment https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451043 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.