Jump to content

[SOLVED] variable changed after submitted


sirup_segar

Recommended Posts

hi..please give me an advice..

{
   $judulx[]=$juduly;
   $pengarangx[]=$pengarangy;
}

before the form was submitted, the content of $juduly and $pengarangy were "jail house's rock" and "amina ana'akira" respectively. but why after the form was submitted, the variable have changed to "jail house" and "amina ana"? was there something important that i forget? thanks in advance..

Link to comment
Share on other sites

Please all of your code, its impossible to tell anything by that.

 

please post more of your code... the code you have posted its too less to make an assumption

sorry mr vicodin and mr rajivgonsalves ;D

this is my form


<form action='shop_additem.php' method='get' name='frmbeli' onSubmit='return cekbeli()'>
<table align='right'>
	<tr>
	 <td>
	     <input type='hidden' name='idisbn' value='$row[1]'>
             <input type='hidden' name='juduly' value='$judul'>
	     <input type='hidden' name='hargay' value='$tmpharga'>
             <input type='hidden' name='penerbity' value='$penerbit'>
             <input type='hidden' name='pengarangy' value='$pengarang'>
	      Jumlah
	     <input type='text' size='1' name='jmlbrgy' maxlength='4'>
	 </td>
	 <td>
	    <input name='submit' type='submit' value='Beli'>
	</td>
</tr>
</table>
</form>

 

and this is my shop_additem.php

if ($jmlbrgy>0)
		{
		   $isbnx[]=$idisbn;
		   $judulx[]=$juduly;
		   $penerbitx[]=$penerbity;
		   $pengarangx[]=$pengarangy;
		   $qtyx[]=trim($jmlbrgy);
		   $hrgx[]=$hargay;
		   $hrg_qtyx[]=$jmlbrgy*$hargay;
		}

 

Show your two variables where you filter it.

@ mr mmarif4u, my two variables are taken from $penerbit and $pengarang.

 

It's because of the apostrophes in the user content.

 

 

{
   $judulx[]=addslashes($juduly);
   $pengarangx[]=addslashes($pengarangy);
}

 

 

@mr themistral, i have tried to use addslashes in front of $juduly and $pengarangy on the top of my shop_additem.php. but i got the same result, remaining chars behind apostrophes were still dissapear.. ???

 

lots of thanks for ur attention..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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