473,769 Members | 5,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=".$_SERV ER['PHP_SELF']." method='post' >\n";
echo"<input class='serred' type=submit value='Verwijde ren'
name='removecon firm' />\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
Jul 17 '05 #1
3 2895
That's because of your line

echo"<input type=hidden name=sqldel value='$sqldel' />\n";

Once executed, you get:

<input type=hidden name=sqldel value='delete from divisies where
divisieid='1c' ' />

"Boefje" < B_*********@Hot mail.com (remove the underscores)> wrote in
message news:pf******** *************** *********@4ax.c om...
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=".$_SERV ER['PHP_SELF']." method='post' >\n";
echo"<input class='serred' type=submit value='Verwijde ren'
name='removecon firm' />\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

Jul 17 '05 #2
Tom Thackrey gave me the solution. Many thanks!

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";
On Thu, 30 Oct 2003 01:23:38 +0100, Boefje < B_*********@Hot mail.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=".$_SERV ER['PHP_SELF']." method='post' >\n";
echo"<input class='serred' type=submit value='Verwijde ren'
name='removeco nfirm' />\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


Jul 17 '05 #3
"Boefje" < B_*********@Hot mail.com (remove the underscores)> schrieb im
Newsbeitrag news:fl******** *************** *********@4ax.c om...
echo"<input type=hidden name=sqldel value=\"$sqldel \" />\n";


You could save yourself lots of escaping by embedding the PHP into HTML
instead of vice versa:

<input type="hidden" name="sqldel" value="<? echo $sqldel; ?>">

--
Markus
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7105
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an empty database, the date time picker returns error 545. Any attempts to progmatically add new records after the empty database has been opened returns, or to use the DTP and set a new date for those added records, "Field not updateable, Bound...
2
3979
by: Alan Hewat | last post by:
I have a relatively modest mySQL database with a PHP interface (70,000 entries). On a standard Dell Dimension 4400 (1.9 GHz with 512 Mbytes) running Suse 8.1 a typical query takes 0.66 sec with no other system load (http://icsd.ill.fr/) On a new IBM dual processor XEON 2.4GHZ (1 GO RAM & 2 SCSI disks) running Suse 8.2 the same query (with no other system load) takes anywhere between 0.5 and 3.0 seconds - randomly variable response for...
41
10678
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query = String.Format("SELECT * FROM dbo.documents WHERE ") & query End Sub
27
10126
by: user | last post by:
Have require file with several query stings in it. Depending on user input one of strings is selected. Everything going along smoothly until I wanted to also input a variable in string. If I put string in program works ok, but, if I use string from require file I can not seem to insert string. $cccb_id is sting..... to be inserted into $query4 and changes depending on user input.
2
3142
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in, if not they are redirected to the login page. If logged in they may edit the story. I assign $_GET to $id.
2
3684
by: Florian Loitsch | last post by:
hi, What should be the output of the following code-snippet? === var x = "global"; function f() { var x = 0; eval("function x() { return false; }"); delete x; alert(x); }
13
3071
by: SAL | last post by:
Okay, don't bash me to hard for my design on this app, it's my first web app and it's in production. My basic design is using Datatables created via the designer with a business logic class in between the datatable and ObjectDataSources. In one page I had a Gridview with select enabled. When an row in the grid is selected, I retrieve the SelectedValue, store the value in a Session variable and redirect the response to another web page,...
3
2789
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to properly inform the user of the fact. How is ths done? Thank you, Doug
20
12760
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The AutoExec macro calls a function "InitApplication" which, in turn, calls a function to set the value of a global string variable
0
10215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5307
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3964
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3564
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.