Jump to content

[SOLVED] using <form> with <input type=image>


sirup_segar

Recommended Posts

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..

Link to comment
https://forums.phpfreaks.com/topic/87869-solved-using-with/
Share on other sites

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 ;D .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..

Link to comment
https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451002
Share on other sites

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.  ;D for mr mmarif4u, thanks for the snippet..it's because i haven't change back the method into post.. ;D. by the way, how can i add the "topic solved" flag to my thread??

Link to comment
https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451022
Share on other sites

ehmm, by the way again,  ;D 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

Link to comment
https://forums.phpfreaks.com/topic/87869-solved-using-with/#findComment-451027
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.