sirup_segar Posted January 29, 2008 Share Posted January 29, 2008 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.. Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/ Share on other sites More sharing options...
vicodin Posted January 29, 2008 Share Posted January 29, 2008 Please all of your code, its impossible to tell anything by that. Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452095 Share on other sites More sharing options...
mmarif4u Posted January 29, 2008 Share Posted January 29, 2008 Show your two variables where you filter it. Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452098 Share on other sites More sharing options...
themistral Posted January 29, 2008 Share Posted January 29, 2008 It's because of the apostrophes in the user content. { $judulx[]=addslashes($juduly); $pengarangx[]=addslashes($pengarangy); } Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452101 Share on other sites More sharing options...
rajivgonsalves Posted January 29, 2008 Share Posted January 29, 2008 please post more of your code... the code you have posted its too less to make an assumption Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452106 Share on other sites More sharing options...
sirup_segar Posted January 29, 2008 Author Share Posted January 29, 2008 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 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.. Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452112 Share on other sites More sharing options...
rajivgonsalves Posted January 29, 2008 Share Posted January 29, 2008 please use double quotes in your input tags <input type='hidden' name='juduly' value='$judul'> should be <input type='hidden' name='juduly' value="$judul"> Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452114 Share on other sites More sharing options...
sirup_segar Posted January 29, 2008 Author Share Posted January 29, 2008 mr rajiv, how do i put double quotes on my form? because i use echo ""; to display my form. so i change all the double quotes into single quotes..should i change it all? :'( Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452122 Share on other sites More sharing options...
rajivgonsalves Posted January 29, 2008 Share Posted January 29, 2008 you should escape them echo " <input type='hidden' name='juduly' value=\"$judul\">"; Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-452126 Share on other sites More sharing options...
sirup_segar Posted January 30, 2008 Author Share Posted January 30, 2008 wow,thanks a lot mr rajiv, that really helps me..cheers.. Quote Link to comment https://forums.phpfreaks.com/topic/88345-solved-variable-changed-after-submitted/#findComment-453000 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.