This is a discussion on variable empty after after posting a delete query within the alt.comp.lang.php forums, part of the PHP Programming Forums category; The variable contains: delete from divisies where divisieid='1c' After posting it contains: delete from divisies where divisieid= So the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
The variable contains: delete from divisies where divisieid='1c'
After posting it contains: delete from divisies where divisieid= So the part '1c' is magically lost! How is that possible? This is more or less the code in my form: $sqldel = "delete from divisies where divisieid='1c' "; echo"<form action=".$_SERVER['PHP_SELF']." method='post' >\n"; echo"<input class='serred' type=submit value='Verwijderen' name='removeconfirm' />\n"; echo"<input type=hidden name=sqldel value='$sqldel' />\n"; echo"</form>\n"; In another part of the form I do this if isset( $_POST['sqldel'] ) { $sqldel =$_POST['sqldel'] echo $sqldel; // this prints: delete from divisies where divisieid= } I tried several things, like addslashes, stripslashes but nothing helps to pass my sql query correctly. Anyone? GB |
|
|||
|
On 29-Oct-2003, Boefje < B_o_e_f_j_e@Hotmail.com (remove the underscores)> wrote: > The variable contains: delete from divisies where divisieid='1c' > After posting it contains: delete from divisies where divisieid= > > So the part '1c' is magically lost! How is that possible? > > This is more or less the code in my form: > > $sqldel = "delete from divisies where divisieid='1c' "; > echo"<form action=".$_SERVER['PHP_SELF']." method='post' >\n"; > echo"<input class='serred' type=submit value='Verwijderen' > name='removeconfirm' />\n"; > echo"<input type=hidden name=sqldel value='$sqldel' />\n"; > echo"</form>\n"; > > > In another part of the form I do this > > if isset( $_POST['sqldel'] ) > { > $sqldel =$_POST['sqldel'] > echo $sqldel; // this prints: delete from divisies where divisieid= > } > > I tried several things, like addslashes, stripslashes but nothing > helps to pass my sql query correctly. Anyone? please crosspost. The problem is you are using single quotes in your html value=' ' which are being munged by the single quotes in your sql try echo"<input type=hidden name=sqldel value=\"$sqldel\" />\n"; -- Tom Thackrey www.creative-light.com tom (at) creative (dash) light (dot) com do NOT send email to jamesbutler@willglen.net (it's reserved for spammers) |
|
|||
|
Many thanks!
GB On Thu, 30 Oct 2003 00:40:58 GMT, "Tom Thackrey" <use.signature@nospam.com> wrote: > >On 29-Oct-2003, Boefje < B_o_e_f_j_e@Hotmail.com (remove the underscores)> >wrote: > >> The variable contains: delete from divisies where divisieid='1c' >> After posting it contains: delete from divisies where divisieid= >> >> So the part '1c' is magically lost! How is that possible? >> >> This is more or less the code in my form: >> >> $sqldel = "delete from divisies where divisieid='1c' "; >> echo"<form action=".$_SERVER['PHP_SELF']." method='post' >\n"; >> echo"<input class='serred' type=submit value='Verwijderen' >> name='removeconfirm' />\n"; >> echo"<input type=hidden name=sqldel value='$sqldel' />\n"; >> echo"</form>\n"; >> >> >> In another part of the form I do this >> >> if isset( $_POST['sqldel'] ) >> { >> $sqldel =$_POST['sqldel'] >> echo $sqldel; // this prints: delete from divisies where divisieid= >> } >> >> I tried several things, like addslashes, stripslashes but nothing >> helps to pass my sql query correctly. Anyone? > >please crosspost. > >The problem is you are using single quotes in your html value=' ' which are >being munged by the single quotes in your sql > >try > >echo"<input type=hidden name=sqldel value=\"$sqldel\" />\n"; |