Handling Multiple Check Boxes
I have a PHP generated page which displays X many records. Each record has a checkbox preceding it. The user checks several checkboxes, and hits a delete button. All the corresponding records will be deleted.
But I'm running into difficulty...
Right now the NAME property of each check box is the primary key of the corresponding record. Hence if I know which checkboxes are checked, I simply use DELETE using the NAME value.
Generally speaking, how do I get the server side to see which check boxes were checked?
The check box names may not be sequential, if any records have been deleted previously, and the first check box might be a number greater than 0.
Is there an easy mechanism to do this? Some kind of built in cnotrol array allowing me to loop over every check box that was on the form submitted?
I could store the last and first checkbox number in a hidden input, then loop starting/ending at those values, but that may loop over a lot of controls that do not exist.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Check Boxes
I have a very little problem with check boxes. How can I write a simple PHP code to tell me when a check box has been checked, and then use the name of the checkbox in a function.
If Statement And Check Boxes.
I have a database full of different articles/stories. I would like to have a publish check box so that if it is checked, that story appears on the homepage, I know how to do this. HOWEVER, i need ot be able to limit this so that only one can ever be checked off... Code:
Checking Check Boxes From Post
I have a group of five checkboxes that I need to check in a script after a post-operaiton. I was using the code: $drv1 = $_POST['driving_1'] but if the user left checkbox "driving_1" empty, i get a php error upon processing. So, I looked in the manual and found the fuction empty(). So I tried: If (empty($drv1)) { then do this } But it doesn't seem to be working. Actually, what I really want is if not equal to empty, something like: If (!empty($drv1)) { then do this }
Multiple Multiple Select Boxes
I'm looking to have multiple multiple-select-boxes on a page. But I can only get the contents from the last selected value within a box, via PHP. I've tried numerous methods. What am I doing wrong? You can see ALL the values present in the url: http://myserver/test.php?notify_use..._updcats=Update e.g.......
Multiple Drop Down Boxes
I want to create two multiple drop down boxes, the first will display all the company names, once this has been selected all the stock information for that company will appear in the second drop down boxes.
Filtering Selection In Multiple Drop Down Boxes
I want to allow a user to conduct a search on a database using multiple drop down boxes. On the first page they will have a drop box filled with records from field A. Once they select which one they want, a second drop down box will then appear with records from field B which are present for field A (a filter). What I want though is that the first dwon down box still appears on the second page, but shows the record that the user selected. What is happening now is that when the second page comes up, the first box shows the default selection rather than the selection that the user chose. My code for the drop down boxes is: PHP Code:
How Can I Print Out Multiple Text Input Boxes?
How Can I Print Out Multiple Text Input Boxes. The function below prints out three text boxes. The code below is static, cannot accept user input, and therefore cannot be changed. What I need to do is write a function or maybe a class that can accept user input and print or echo a different number of text boxes, depending on the user input. The name variable for each of the textboxes needs to have a different name. For example, the name for the first text box would be something like "name=textfield1", the second would be "name=textfield2", and so forth. PHP Code:
Handling Multiple Sql Statements
I am trying to do multiple queries from two databases on two different servers.I try to always use comments, what i'm doing here is having a select option, the select option has a value based on a session, basically session_id = userid, select userid in products,, print products, that. From there, store the product id in a variable, and call the product id, as well as the form to get me info from the other database, and then display the info. Sounds easy when I write it like this, but when I write it in code, it doesn't seem to work, it pulls me info, from the product id, but it's not taking any data in the form. I know I should not have a form submitted this way, it's bad for security reasons, but honestly I have no idea how put it in another form, and then call the info back to put it in the specific spot of the table. Can anyone tell me why it's not taking my form data, and also how I can make a query that goes something like this $query1 = "SELECT * FROM ei10800010001200708 WHERE NumeroExterno = '$productid'"; and (part I don't know how to search for) in between fetchadesde and fetchahasta where fetchadesde = $startdate and fetchahasta = $enddate and in between horadesde and horahasta where horadessde = $starthour and horahasta = $endhour That is a type of query i'm trying to get for my results, and I apoligize for the Spanglish, but I work for a spanish company and don't speak good spanish, which frankly just makes life hard. Does anyone have any recommendations? My code:
Correct Handling Of Multiple Sessions
For accessibility reasons I have replaced data being derived from a javascript triple drop down menu on a form feeding to a php page for processing. The replacement method uses a series of pages. A form with radio buttons in an htm page feeds into a similar php page where a session is created - and feeds through to another similar page where a second session is created – with the posted information and the 2 sessions being fed to the final php page for processing. I did not want to use viewers’ cookies – they are often disabled, I’m told. It works. But I am brand new to sessions, and wondering if I have done this correctly. Page1.htm contains a normal radio button form, which posts ”size”. Page2.php has the following at the very top (pre Doctype):
PHP Handling Of Multiple Select Fields
If I have a select element of a form that have the MULTIPLE attribute with name="temp", what will the variable names be in the action page (POST)? Will the first one be $temp[1], second $temp[2] and so one? This does not appear to be the case.
Handling Multiple MySql Connections
I thought this was possible, but apparently I am wrong, or I am doing something wrong. I need to be able to track and use two different mysql connections in a class. So far my class looks like this: PHP Code:
Headers, Octet-streams, & Handling Multiple Requests
I have a page with several links to different 'user' files (which are located outside the webserver). Clicking on the link executes a php file that does some user validation and returns the 'user' file via a header: <?PHP ... //force download dialog header("Content-type: application/octet-stream"); header("Content-disposition: attachment; filename="$file""); header("Content-transfer-encoding: binary"); header("Content-length: " . filesize($path) . " "); //send file contents $fp=fopen($path, "r"); fpassthru($fp); exit(); ?> The issue is, while they wait for one file to download they can't request another file until the script finishes streaming the first file. Is there a way around this? I thought maybe using "Content-Type: multipart" might work. Anybody have and idea how I would do this?
Handling Case Of Field Names In Multiple Db's
(Bottom line: I think what I'm looking for is an easy way of changing the case of key values in an array.) I've got code that I'm trying to make agnostic about the underlying database system I'm using. That is, I want the code to work whether the underlying db is MS SQL, MySQL, Oracle, etc. I'm using the PEAR DB package, and it's great for what I'm trying to do...except in one area. I get the returned row fields in an associative array, where the element key is the field name and the element value is the field value. The problem is that MS SQL returns field names in mixed case (actually, it returns the field names in the case the user used to define the field names in MS SQL in the first place), while Oracle returns the field names all caps. So, if I have the same db on MS SQL and on Oracle, I can't easily access the field values. For example: $row*=*$result->fetch_row(DB_FETCHMODE_ASSOC); Now, if I print_r($row), I see something like: Array*( ***[My_Id]*=*1; ***[Name]*=*"Fred Flintstone"; ) If I run this under an Oracle db, I might get this, instead: Array*( ***[MY_ID]*=*1; ***[NAME]*=*"Fred Flintstone"; ) So my code cannot say something such as: $id*=*$row["My_Id"]; That would work for the MS SQL version, but not for the Oracle version. I certainly don't want to say something like: if*($IsMsSql)*$id*=*$row["My_Id"]; else*$id*=*$row["MY_ID"]; I really don't have control of how the users define the case of their field names, otherwise I could tell them to upper-case them all the time. But that might not work, if a different set of db routines that DB uses returns field names in all lower case. I could do the following, but I'm not sure I want to take the efficiency hit (maybe it isn't so bad; I don't know): foreach*($row*as*$key*=>*$value)*{ ***$row*[strtoupper($key)]*=*$value; ***unset($row[$key]); }
Handling Multiple PortType Definitions With The Same Method Name With Built-in SOAP
I am trying to communicate with a WSDL that defines to portTypes: - <portType name="General"> - <portType name="Session"> And their exists 2 operations with the same name but in 2 different porttypes (the general "GetList" returns a default list of items, the session "GetList" requires a session ID to be passed in the header and returns a list based on the session ID): - <operation name="GetList"> <soap:operation soapAction="urn:XXX-General#GetList" style="rpc" /> - <input message="tns:GetListRequest"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:XXX-General" /> </input> - <operation name="GetList"> <soap:operation soapAction="urn:XXX-Session#GetList" style="rpc" /> - <input message="tns:GetListRequest"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:XXX-Session" /> </input> When I try to create a client using the build-in SOAP (PHP 5.1 beta 3), like this: $client = new SoapClient('http://localhost:8095/soap', array("trace"=>1, "exceptions"=>0)); I get the message: Fatal error: SOAP-ERROR: Parsing WSDL: 'GetListRequest' already defined in d:InetpubPHPsoaptest.php on line 12 Is there a way to handle this situation so that I can specify the portType, service name, or port name so that the available methods won't be duplicates?
How To Check For Multiple @'s
We are trying to prevent spammers from mass mailing their list while using our contact us script. We have a few security measures in place but would also like to add a "check for more than 1 @'s in the to:, cc: and bcc: fields. Can anyone point us to some code or turotials for doing this?
How To Check If Multiple Of 2?
I am creating a tournament script and need to have total matches as a multiple of 2 (2, 4, 8, 16, 32... ). How can i check the number to see if it's ok. example $matchesNum = 38;//obviously this is not a multiple How would I check that number to make sure it was 32 or 64...
Check If Variable Is Multiple Of TWO
Is there another fast way (withOUT to call a PHP function), to do this? It is to know if a variable (into a loop) is a multiple of two. PHP Code:
Check For Multiple Occurances In An Array.
I am checking an array for existence of a value, but I want to see how many times it exists in the array. Is there a quick function to do this or must I use a loop and step through? I looked through the manual and did not see any array functions that would do this, but I may have misunderstood one of them. Which has happened before. I was using this before I realized I had multiple occurences in the array. PHP Code:
Multiple Variables Eregi Check.....
This is an easy one I think but I just can't do it for some reson - I want to check more than one variable on the same line, not just address, but can't work out the syntax to do this... ie. So this code........ $crack=eregi("(to:)|(from:)|(cc:)|(bcc:)",$address); does this........ $crack=eregi("(to:)|(from:)|(cc:)|(bcc:)",$address and another variable); I want it so that if any of the variables meet the criteria set in the eregi function then $crack will be true (or 1).
Reading POP Boxes
I've been looking round for something that will read the contents of a pop box and populate a MySQL table. The e-mails will all be of a fixed format and include a jpeg as an attachment. I need to put the following columns in: sender subject body filename (possibly appended to the date to mitigate the risk of The script would also need to save the attachment to a predetermined folder. Does anyone know of anything that would do this? Alternatively, how much would it cost for someone to get this working for me?
Alert Boxes
do u know the alert box in javascript? when u write alert("somthing"); well i need that in php what is the alternative function for that in php?
Combo Boxes Question
I am wondering how I can make the whole array appear in the code that is below with the database entry to be selected. At the moment it just displays the database entry.
Populating Two Combo Boxes
I have one combo box (Category) which is populated by a MySQL table using php. I am trying to use the onchange javascript to submit the value selected so that I can populate the other combo box (sub-category) based on what was previously choosen. So can anybody give me a clue on how to submit the first boxes value so that the second can see what was selected (javascript function).
An Array Of Text Boxes
I have the full code in a php script where I essentially display a form with checkboxes, and 2 text boxes associated with each checkbox to record grades ( marks and remarks ). The form displays correctly and the checkboxes I select do pass the correct id numbers for the students to be graded, also the numeric data in the first textbox is correctly transmitted HOWEVER the data in the second textbox gets randomly truncated. e.g, if the "remarks" textbox has 'hello', it gets truncated to 'o'. It seems I'm not resetting something or there is another simple oversight somewhere, perhaps the script treating the data as a string rather than as an array Code:
Dynamic Combo Boxes
i have a problem with creating some dynamic combo boxes. i have a form and the user enters the number of printers required, on the recieving page i display that many combo boxes ready for their input...but the problem is its not generating the correct number of combo boxes for some reason. i think i'ts because i need to reset the cursor on the result set so it can whip through the printers again but am not sure. please see following code:
Printing Colored Css-boxes
I've got a page with a couple of tables inside a couple of colored boxes(css-style), but when I try to print the page I end up with a copy without colors.
Form Drop Down Boxes
I have a bunch of products i want to add to a database, i have a form to submit the products to the database. What i need to crack is to have a drop down box for category 1 (beer or wine) and then automatically populate the drop down box for category 2 depending on the first selection if cat1 = beer then cat2 options = Lager, Malt, Stout. if cat2 = Stout then cat3 = Guiness, london, Old boot. if cat3 = Guiness then cat4 = Bottle, Can. I have four sub categories so need this to work on the fly before adding all info to the database ...
Conditional List Boxes
I am attempting to create a list box that is dynamically populated based on the selection of another list box. I am in way over my head..only way to learn I guess. The code below has a year listbox and then based on the year selection, the page should either show another listbox (show industry selection when year <> 2005) or it should render the main form (when year=2005). I cannot get the main form to appear. Code:
Dynamic Text Boxes
I have a form where field techs can close out service calls, Time in, time out, work done, who the tech is....ect... Currently I have 20 fields for parts..... Part1 / Part1QTY....and so on to Part10 / Part10QTY.... the form emails, and it also feeds data into MySQL... so everything is working fine... What I would like to do, is stream line it...so there is only 2 fields...part_number and qty....and when techs needs to enter more parts then click on a button that creates 2 new sets of text boxes for input.... thus allowing me to have them enter more the just 10 parts and qty's. I thought about, maybe having a secondary form on my HTML page, with different sets of submit buttons, and they can enter 1 part at a time... but I could not get the secondary form Submit button to not clear the data in the primary form...so that didn't work for me.! I'm am basically stuck here... there maybe one or two other issues I have...but those are not so critical. I do have a great deal of MS Access experience but this PHP is a totally different monster. For those who know access, it's very easy to add a new record in a subform and just keep adding records...which is sort of what I'm trying to do here.
Dynamic Listy Boxes
we are trying to buid some dynamic list boxes. Our code that generates the listbox creates a string containing the list box definition and the last line of the file is echo $outstr. When we execute this, the list box works fine. Now when we embed it into am html page in this way: <?php include statuslistbox.php ?>, we get errors that say "constant statuslistbox.php not defined" The listbox define file has the php brackets top and bottom. The embeding html has no brackets other than the ones show above. It seems to make no difference if the calling file is a php extension html extension.
Drop Down Answer Boxes
how to insert drop down answer boxes (like the oes you get in questionnaires) into my cong, i can't seem to get the coding right or make anything appear in the box.
Generating Drop Down Boxes From Mysql
i'm using php with mysql. i need to be able to extract items out of my database and put them into a drop down box so that the data is dynamic. In this example, i need to get all of the names from the name.office field into a drop down box to be used in further scripts/processess. <html> <head> </head> <body> <? $db = mysql_pconnect ("localhost", "XXXX", "XXXXX"); if (!$db) { echo "error: could not connect to database. please try again later"; exit; } mysql_select_db("XXXXXXX"); $query = "select name from office"; $result = mysql_query($query); $num_results = mysql_num_rows($result); $row = mysql_fetch_array($result); ?> </body> </html>what goes here??? i have tried many things and not been able to get it to work.
Spaces In <input Text> Boxes.
When I submit a form where a user has typed a space into the input box, then check that value in the action .php file, only the text before the first space is displayed. How can I get all of the text sent? eg Code: <form name="form2" method="post" action="temp.php"> <input type="text" name="name"> <input type="submit" name="Submit" value="Submit"> </form> Then in temp.php Code: echo "Username = $name"; If the user enters "Greg Bennet" into the text field, I get back "Username = Greg".
Dynamic Text Boxes With While Loop?
Basically I have a dynamic number of categories. Each of these categories requires a text box, therefore I have a dynamic number of text boxes. My question is if there is anyway using a while loop that this can be done? <? while ($nextcat = array.php($categories)) { echo $nextcat; $varname = $strip_tags($nextcat) ?> <input type = textarea name = <? $varname ?>> <? } ?>
Dynamic Dependent Drop Down Boxes
I need to build a dynamic page with 2 drop down boxes on it where the contents of the second drop down box are dependent upon the selection made in the first drop down box (the first box contains districts/regions and the second box contains towns/cities). The customer wants this to happen on a single screen but can this be done with PHP?
Dynamically Filling Selection Boxes
I was wondering if anyone knows how to fill a selection box with different values depending on a selection made in a nother selection box in the same page. I dont know if what I'm tryin to do can be done or not, at least in PHP. First a quick background: We have a number of projects running right now, each of which is subdevided into various tasks. Now, I've got two selection boxes. The first contains a list of all current projects. What I want to do is this: when someon selects a project from the first box, I'd like the second box to be filled with a list of the tasks that have been assigned tot hat project.
Dynamic Drop Down Boxes With Php Query
I need to build a dynamic page with 2 drop down boxes on it where the contents of the second drop down box are dependent upon the selection made in the first drop down box (the first box contains districts/regions and the second box contains towns/cities). The customer wants this to happen on a single screen but can this be done with PHP? The above question is already answered by many people and they want me to use Javascript. My doubt is the second box shoud query the list from a table in mysql using php. How do i do that?
Using Mail() And Avoiding Spam Boxes !
Im using the mail() command to send an email to people who register on my site, but many are ending up in people's spam boxes on hotmail. This problem isn't true of all users - probably around 60%. Im being as open as possible using a number of headers, but can anyone suggest a way of getting through with less problems ? $sender = "From: Name <email@domain.com>" . ""; $sender .= "Return-Path: email@domain.com" . ""; $sender .= "MIME-Version: 1.0" . ""; $sender .= "Content-Type: text/plain; charset=iso-8859-1" . ""; $sender .= "Content-Transfer-Encoding: 8bit" . ""; $sender .= "X-Mailer: PHP/" . phpversion();
Passing Values From Text Boxes
what I'm trying to do is pass some values from text boxes, yes it may sound simple, but let me explain more... I've got a form, and what I want to do is that when you enter a new question and select a existing category from the drop down box, it then inserts the values into the database no problem. However if enter a new question, and a new category, then submit the info, I get a null value. The Code...
Punctuation Marks In PHP Text Boxes
I am not a PHP user; I manage the server/ network for our business. We've employed web developers (chosen because they're friends of the MD) to build us a site and they've used PHP & MySQL to do it. The problem we have is that if we use an apostrophe when writing a product description or product title in the back office of our site, when that data is then used or carried through to another part of the site eg. a live product page or an order summary page, the apostrophe has a backslash before it. We have run into other issues with the use of various punctuation marks in the text fields of the back end of the site and have always been told by the developers that it is a fault of PHP and is common with PHP text fields. Now, as I said, I'm not a PHP user and certainly no expert. But I have installed and used Mambo Server, Wordpress, phpBB and a couple of other PHP MySQL products through my own curiosity and have done so successfully and have never experienced any of the issues we seem to be facing with these text boxes. I am growing increasingly suspicious of the level of competence of the developers and feel that they are making excuses for their inability. Can anyone tell me, from what I've said here, whether my suspicions are justified or is it the case that PHP is limited in these areas?
Drop Down Boxes Change By Selection
what i'm trying to do is when a user selects a country say UK, all the uk states are displayed in another selection box below BUT if the US is selected all the us states are shown, this is on nion every friends/dating site just curious as to how this is done.
Selections On Dropdown Selection-boxes
I have a article manager script that im nearly done with and when you press save, it takes you to another page to check that you have entered the required fields by checking for the POST vars, if not it redirects back to the page and stuffs the entered fields into GET vars header( location: file.php?errors=$errors&var1=$var1 ) 's you back to the previous page. Now i have no trouble reshowing the entered info in regular text fields as i grab it from GET but i dont seem to be able to reshow a drop down box selection it always reverts back to the first option when i redirect the page.
Dynamic Drop Down Boxes With Mysql
I'm working on a database project for a class and am having problems populating select boxes with a field from a mysql table. The first thing that I'm trying to do is pull the field LastName from the table Faculty. Then when the user selects the faculty member in the drop down box, it will then display all of the fields related to that faculty member...first and last name, title, office number etc and allow the user to edit those fields and then resubmit them to the database. However I can't seem to get the drop down box to populate, so if anyone has any suggestions as to how to fix this I would love to hear them. Code:
Avoiding Php Mail() To Spam Boxes
I'm sending soliticited emails for a nonprofit and i'm finding when i use PHP's mail function, and the mail goes through my ISP's SMTP, a decent percentage of the mails go to people's spam boxes. are there known headers or something i could add to my code to make them less spam box prone?
Long Strings In List/menu Boxes
Is there a way to get a list/menu box to resize as the page is resized and for any long string that is an item in the list to be spread over two or more lines in the same way as text in a table does.
Dynamic Number Of Text Boxes/insert
On page one I ask 'How many boxes do you want?' and I have a simple form - the code is below: <form action="addhouses.php" method="post"> <input type="text" name="numimages" size="3"> <input type="submit" name="submit" value="Submit"> </form> On the next page I want to display how ever many boxes they said on the previous page. Let's say they choose 4 - there are then 4 boxes which allow you to browse to files on your computer. Clicking submit on this page takes you to the third page which uploads the files and inserts the filenames into the database. Currently the code I have on the third page works fine for a static number of defined boxes. It is: PHP Code:
|