variable empty after after posting a delete query

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


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-30-2003
Boefje
 
Posts: n/a
Default variable empty after after posting a delete query

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
Reply With Quote
  #2 (permalink)  
Old 10-30-2003
Tom Thackrey
 
Posts: n/a
Default Re: variable empty after after posting a delete query


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)
Reply With Quote
  #3 (permalink)  
Old 10-30-2003
Boefje
 
Posts: n/a
Default Re: variable empty after after posting a delete query

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";


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0