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.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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.
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:
Dynamically Populating Listboxes Based On Previous Selection
How do I populate the second listbox in this form based on the selection of the first listbox? The first listbox is populated by this query: $year_query = "SELECT distinct year FROM bench_data"; The second listbox should essentially be populated by this: $industry_query = "SELECT distinct comp_desc FROM comp_desc, benc_data where $_POST['year']=bench_data.year and bench_data.comp_key=comp_desc.comp_key"; I know this is alot to ask, but please EXPLAIN the code. I am new and need the explanation elucidated and not just supplied code that will accomplish the goal. Code:
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
Repeated Filling
How do I fill up a form continously and submit it remotely? Meaning, the form info comes in from a dbase using php and gets submited to a remote site. All this happens automatically.
Zero Filling Integer
Is there a way in PHP to zero fill an integer to a specified length? For instance, if I have a two digit number, and I want to zero fill it to four digits, is there a PHP function I can use? Or do I manually have to add zeros to the front?
Filling Variables From SQL
I have a dynamic dropdown menu filled with names of people that posted to the guestbook. When I select a user I want info about that user to show up (ip, when posted...) if(in("show")) { $id = $_POST['info']; $action = "SELECT * FROM entried WHERE id = '$id'"; $result = mysql_query($action); $name_info = ??? $ip_info = ?? } How can I fill in those variables (name_info , ip_info ) with information from SQL (fields are name , ip ...)
Filling Out Forms Through Proxies With Php
i'm connecting to the internet via a proxy, and am having problems filling out forms... below is the code i have, and below that is the http request i am trying to make it look like. they look the same to me, but it isn't working, so i guess they aren't... $proxy = fsockopen("tcp://someaddresshere", 80, $errno, $errstr); $temp = "somethingelse=blablabla"; fputs($proxy,"GET somesite HTTP/1.0"); fputs($proxy,"Accept: */*"); fputs($proxy,"Referer: http://someothersitesite"); fputs($proxy,"Content-Type: application/x-www-form-urlencoded"); fputs($proxy,"Content-Length: " . strlen($temp) . ""); fputs($proxy,$temp . ""); while (!feof($proxy)) print fgets($proxy); fclose($proxy); with that script, i don't get anything. however, with this http request, from opera 7.10, i do: POST http://somesite HTTP/1.0 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.10 [en] Host: somesite Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: en;q=1.0 Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1 Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0 Referer: http://someothersite Proxy-Connection: close Content-type: application/x-www-form-urlencoded Content-length: xx somethingelse=blablablaHTTP/1.1 200 OK Via: 1.1 DELTANS Connection: close Content-Type: text/html Date: Fri, 20 Jun 2003 17:54:37 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.1.2 mod_perl/1.26 X-Powered-By: PHP/4.1.2 Set-Cookie: PHPSESSID=6c6baebea48c1ee4ad562d7fef3a46a4; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: something Set-Cookie: something now the last part of the http request isn't a request persay, but whatever,....
Form Filling PDF Template
I realise there is a lot written on this subject, but as a newcomer I'm not having much luck finding a solution to my particular problem. Grateful for your help! I need customers to be able to enter information into a form and receive a non-editable PDF document, by email and/or in the browser, containing that information (with a specific layout based on a template) after submitting the data. I have found numerous libraries like PDFkit etc that might well do this. I'm not sure if I can install the library onto my host server though - is it normal to be able to do this? There's also the Acrobat forms option. However, I need this to be fool proof. If the client does not currently have Acrobat reader installed on their computer, would they not be able to view the PDF form, thus limiting accessibility? I also want to avoid FDF if possible because it seems that, again, there's the potential for the browser not to open the file properly, or problems if the client doesn;t already have Acrobat reader installed.
Filling An Array With A Set Of Values
i know there's a way to fill an array with a predetermined set of values (i.e. 0-999, a-z, etc) but i can't find the right syntax for the task nor find any examples.
Problem Filling An Array
I'm writing code to validate fields in a form before saving to a db. All the validating functions are in a separate script which is required. All the validating functions add an error message to an array if the data doesn't validate. I check if something went wrong with count($theArray). Here's my code:
Automated Table Filling
Ive put a whole bunch of images into MySql, and am referencing them through PHP. The code is as follows... PHP Code:
Filling MySQL Table From Within PHP
I don't seem to get the following right. In the following I try to fill a MySQL table named 'mutation'. The first element is a date but MySQL sees this as 0000-00-00 instead of the date 2002-11-01. Other problem is the textstring in $_POST['verklaring1'], in MySQL this stays empty. <?php $query = "insert into mutation values (2002-11-01, 1, 4, 1, 4, 10, 330 , ' $_POST['verklaring1'] ',N,N,N,N)"; mysql_db_query("projects", $query); ?>
Filling In For Deleted Images
I am creating an image gallary where the images are numbered 1, 2, 3 etc. Users will be uploading the images so if i need to delete an image, I need the code to be able to check if that number has been deleted and replace it with the next uploaded image. I have the code pulling from a txt file with a counter to name each file. The problem is that if images "36", "29" and "2" are removed... I need those slots to replaced in numerical order with the next uploaded images. So the next image will be named image "2" and will show up as the 2nd image on the page. Code:
Filling Form With Database Info
I have a table with 5 fields for a tour business activity list : (1) id -table key (2) name (3)description (4)picture -text link not binary(5) country. I would like to create a form that takes all the activitys an puts it neatly down on site in checkboxes so user can select activtys.this will be linked to form mail.i would like the activitys to be seperated by the country they r in?
Filling An Array Depending On A Variable
I want to fill an array with numbers depending on a variable. On the page for holiday booking, the user gives the date of arrival and the date of departure, now i have written code to determine the number of days the user is staying. Say this is 5, now i want to fill a variable with the numbers 1,2,3,4,5 If the user stays 3 days the variable should be filled with 1,2,3 I came up with this ....
How To Shortcut Execute Php Script Without Filling Out Form?
There is a website that has two input boxes inside a POST form that uses the action="rcon.php" here is the code for the form: <form method=POST action="/rcon.php"> <input size=25 type=text class="sm" name="addr"> <input size=20 type=text class="sm" name="rcon"> <input class="coolbuttonblue" type=submit value="Submit">...
Efficiently & Safely (re)filling Array From $_POST
I'm using a single script to generate a table with <input>s in each row. I fill the array with initial values, then write it out to the table and let the user edit the values. Something like: $myarray = $array(1, 2, 3, ... 100); echo 'Enter your changes, then click Submit:' foreach ($array as $i) echo '<table tags> <input value="'.$i.'" name="index.'$i.'"> <table tags>' When the user clicks Submit, I need to pull the values back into the array so I can re-display & operate on it. The data is in $_POST, which is associative and contains stuff other than my array. $_POST contains something like: Submit=>submit someVariable=>someValue anotherVariable=>anotherValue index1=>1 index2=>99 index3=>93.2 .... index100=>-3 After doing a quick google search, I tried: for ($i = 0; $i < count($array); $i++) { $name = 'index'.$i; $array[$i] = $_POST["$name"]; } It runs, but I get nothing out of $_POST - those key values are unset. Is my only option to inefficiently iterate through $_POST AND $myarray, and doing the assignment to the proper element when I find the corresponding name in $_POST's key? Can I use the $_POST keys as indexes in a loop? If so, is it *safe* to do that, and what's the syntax? Something vaguely like: for ($i = 0, $key = index1; $i < 100 && $key < index100; $i++, $key++) array[$i] = $_POST[$key];
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.
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:
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.
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:
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:
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.
Selection
I am making a log generator and I have a minor issue with this script PHP Code:
Selection Box Via Selection
Basically I have a selection box which gets it's values from a database once this is selected the selection box's below will get the correct value from the above selection box which again comes from the database. The first selection box works by refreshing the current page and adding a variable to the file for example instead of useraddnew.php it would be useraddnew.php?maintcat=5 but the number 5 only gets set the second time you choose from the top selection I hope some one can help sorry if I explained it poorly. Code:
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?
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...
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.
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 }
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?
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?
|