473,811 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

post without form ?

I have this list of logs stored in a MySQL DB.
I display them in a list and next to each log I have a del view LINK

I want to add Checkboxes next to each log and keep del and view links as
well.

Then you can select all the logs you want to delete, hit a delete Link and
send the variables in a script...
Can you do that without having a form ?

Can you have a checkbox without having a form ?

It sounds a bit awkward but I am just wandering

<li><a href="transacti on.php?contCat= <? echo $contCat
?>&action=delet e&contSubCat= <? echo $contSubCat ?>&content_id=< ?php echo
$row['backup_id']; ?>"onClick="ret urn formConfirm('de l')">Del</a><input
name="<?php echo $row['backup_id']; ?>" type="checkbox" value="1">
</li>
Jul 17 '05 #1
6 6644
Nope -- without a <form> tag the checkbox values won't make it to the
next page.

Jul 17 '05 #2
"Angelos" <an*****@redcat media.net> wrote in message
news:d8******** **@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com...
I have this list of logs stored in a MySQL DB.
I display them in a list and next to each log I have a del view LINK

I want to add Checkboxes next to each log and keep del and view links as
well.

Then you can select all the logs you want to delete, hit a delete Link and
send the variables in a script...
Can you do that without having a form ?

Can you have a checkbox without having a form ?


Not one that will do anything, unless you also want to use JavaScript. Of
course, that brings on a whole pile of other issues.

Why would you not want to have a form?

Jul 17 '05 #3
Angelos wrote:
I have this list of logs stored in a MySQL DB.
I display them in a list and next to each log I have a del view LINK

I want to add Checkboxes next to each log and keep del and view links as
well.

Then you can select all the logs you want to delete, hit a delete Link and
send the variables in a script...
Can you do that without having a form ?

Can you have a checkbox without having a form ?

It sounds a bit awkward but I am just wandering

<li><a href="transacti on.php?contCat= <? echo $contCat
?>&action=delet e&contSubCat= <? echo $contSubCat ?>&content_id=< ?php echo
$row['backup_id']; ?>"onClick="ret urn formConfirm('de l')">Del</a><input
name="<?php echo $row['backup_id']; ?>" type="checkbox" value="1">
</li>


If you want to use javascript you can do this. In place of a submit button
you have a button that runs a script in the browser. The script walks
through the checkboxes and builds a list of the ones that are checked. It
generates a link that might look like this:

var Destination = "deletes.php?li st=" + list;

Then it jumps to that location with:

window.navigate (Destination);
--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec )ure(Dat)a(.com )
Jul 17 '05 #4
> <li><a href="transacti on.php?contCat= <? echo $contCat
?>&action=delet e&contSubCat= <? echo $contSubCat ?>&content_id=< ?php echo
$row['backup_id']; ?>"onClick="ret urn formConfirm('de l')">Del</a><input
name="<?php echo $row['backup_id']; ?>" type="checkbox" value="1">
</li>


Ok considering wi have the above code tha loops and lists a Number of DB
entries
how can we assign a checkbox in each of them and then retrieve each
checkboxs' value in order to delete the appropriate record when the form is
submited ?

THanks !!!

Jul 17 '05 #5
Ok try something like this (example code... i tried to comment in it as
much as possible):

for this example.. logs table structure:
id (primary, auto-increment)
description

---------------------

<?

include("db.php ");
//connect to db

if(!isset($_POS T['submit'])) {
//form isn't submitted

echo "<b>Logs</b><br><br>";

echo "<form action=\"\" method=\"post\" >";
$query = "SELECT * FROM logs";
$result = mysql_query($qu ery);
while($row = mysql_fetch_arr ay($result)) {
$id = $row['id'];
$description = $row['description'];
echo "Log: $description <input type=\"checkbox \" name=\"log_$id\ "
value=\"1\"><br >";
}
//get all log values, and present checkbox
//NOTE: checkbox values are prefixed with 'log_', explained later..

echo "<input type=\"submit\" name=\"submit\" value=\"Delete\ ">";
//input button

} else {

foreach ($_POST as $key => $value) {
if(strstr($key, 'log_')){
//if the value contains log_ then its used
if($value == '1'){
$id = str_replace("lo g_", "", $key);
//log_ prefix is removed to get the id
$query = "DELETE FROM logs WHERE id='$id'";
mysql_query($qu ery) or
die (mysql_error()) ;
//deleted..
}

}

}

echo "<b>Done</b>";

}

?>

---------------------

ok basics behind the script...

since theres an unknown number of form values the following is used:

foreach ($_POST as $key => $value) {
//code
}

....which loops through all the form elements and their values.
However this can cause a problems, because other form elements will be
picked up other than the checkboxes, such as the input button. THIS is
the reason that i prefixed all checkboxs with 'log_', so it can later
be checked.

i hope this is the kind of thing you are after ;)

-eilks

Angelos wrote:
<li><a href="transacti on.php?contCat= <? echo $contCat
?>&action=delet e&contSubCat= <? echo $contSubCat ?>&content_id=< ?php echo
$row['backup_id']; ?>"onClick="ret urn formConfirm('de l')">Del</a><input
name="<?php echo $row['backup_id']; ?>" type="checkbox" value="1">
</li>


Ok considering wi have the above code tha loops and lists a Number of DB
entries
how can we assign a checkbox in each of them and then retrieve each
checkboxs' value in order to delete the appropriate record when the form is
submited ?

THanks !!!


Jul 17 '05 #6
> i hope this is the kind of thing you are after ;)

-eilks

Yep ... it looks to be what I want ;-)
That _log prefix does the work !!! :)
Thanks a lot !
Jul 17 '05 #7

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

Similar topics

5
4264
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the second form when it is called. Both forms are .htm files that call themselves when the submit button is press via the following command in each form: <form method="post" action="<?php $server?>">
2
14059
by: Erik Johnson | last post by:
I am trying to work with a program that is trying make an HTTP POST of text data without any named form parameter. (I don't know - is that a normal thing to do?) I need to write a CGI program that accepts and processes that data. I'm not seeing how to get at data that's not a named form parameter. I wrote a simple CGI program to echo a string representation of the cgi.FieldStorage class that's recevied, and one to make an HTTP POST to it...
8
4894
by: Victor | last post by:
I need to redirect to another web page, but that redirect will include the submission of form data. So, unlike ServerXMLHTTP which stays on the originating web page, I need the script to redirect to the page that I'm submitting the POST data to (without pressing a submit button). Any suggestions? Thanks, Victor
10
1945
by: ramata | last post by:
This is really strange for me. I have a demo.asp page, that can't pass hidden value "mr progrramer" to itself using POST method. Only "mr" is passed. I created a second asp file demo1.asp and passed "mr programmer" and whole string (include space b/w mr and programmer was passed successfully). The code for demo.asp is
3
3265
by: iam247 | last post by:
Hi I have an asp page without any javascript. It posts the content of a form to another page, which reads the form fields using Request.Form. This is the form header: <form name=form method=post action=RegDetails.asp> I have tried to modify the form by adding javascript for password
1
8030
by: Mad Scientist Jr | last post by:
How do you get a ASP.NET page to return nothing, so the page posting form data to it doesn't reload? I have tried all combinations of the following: Response.SuppressContent = True Response.BufferOutput = True Response.Cache.SetNoStore()
2
12564
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser <form action="display.aspx" method="post" target="_blank"> will submit the form data and open display.asp in a new browser
10
3444
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a database or continue to process on to the next page. I am now trying to learn ASP to see if we can replace some of our applications that were written in php with an ASP alternative. However, after doing many searches on google and reading a couple...
10
2445
by: eggie5 | last post by:
Is it possible to get a file without using a form post? I want to get the data (bytes) of a file, text or binary, and just save it to a variable. Similar to the post body of a form that has a file input element in it. Ultimately what I want to do is get a file off client machine (that they specify) and send it to the server using a standard post request. This is exactly the same as a form post with an file input element, but I don't...
2
6112
by: shadowman | last post by:
So here's the situation: I need to write a PHP script which accepts form submissions using all methods (GET and POST) and all content types (application/x-www-form-url-encoded and multipart/form-data). And for POST method, it has to be able to get the exact bit-for-bit accurate contents of the POST body. Now here's the problem: I'm stuck with POST multipart/form-data. The $GLOBALS only works with application/x-www-form-url-encoded. It...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10403
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
9208
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
7671
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
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4341
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
3
3020
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.