Dynamic Text Inputs
I'm generating dynamic text inputs on basis of database records.
while ($row = mysql_fetch_array($query)){
?>
<?=$row["product_name"]?>:
<input type="text" name="quantity[<?=$row["id_product"]?>]"><br><?
Then I try to write quantities in a database:
$frm = $HTTP_POST_VARS;
foreach ($frm["quantity"] as $quantity){
$id_product = key($frm["quantity"]);
$query = mysql_query("INSERT INTO quantities(product_id, quantity) VALUES ('$product_id', '$quantity')");}
But this doesn't work. When I browse the table "quantity" all product IDs have the same ID. What am I doing wrong?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Forms With Dynamic Inputs
I have a php page with a form in it, that is along the lines of: <form...> item with id 234 <input type=submit ... NAME=add234 ID=add234> <input type=hidden NAME=add234 ID=234> item with id 235 <input type=submit ... NAME=add235 ID=add235> <input type=hidden NAME=add235 ID=235> [....etc....] </form> In the PHP code at the top of the document, I want to: a. intercept any submit from the form b. get the related ID number At the moment, I have only one add button, so I use code like this: if($HTTP_POST_VARS[add]){ ... ..... } So my questions are: A. how can I change if($HTTP_POST_VARS[add]){ to make it intercept any submit button that starts with add B. how can I get the corresponding ID number
Validating Text Inputs
I have a forum which i made and i wish to check the input to stop any SQL injections being made. IN the db i have the column set to TEXT. How can i make sure that what the user inputs is safe... i know i could ereg or ctype it but if i write the text then press enter it doesnt allow it. Without the enter it works fine but with a enter space it doesnt...
Dynamic Text Area
how do I create a dynamic text area that whenever I select a value from a dropdown list it will automatically fill up the form of my html. the dropdown list contains dynamic values from mysql database. Whenever I click a value, it automatically fills up say for example the name, address, email, etc...
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.
Problem With Dynamic Text Fields
My goal is this: A user logs into the site and is presented with a directory listing (this is done, check). He then clicks on the directory, each which has their own amount of text files within them, and a page loads up presenting either text areas or text fields depending on the type of text file (some only hold one number, others just hold text). The text will already be entered into the text field, so no re-typing will be necessary, and if editing needs to be done, it can be. There is currently a map made in Macromedia Flash which relies directly on these text files to output certain information. I want to be able to alter the text files, and in turn, alter the Macromedia Flash. I understand that all of this can be done easier with databasing, but that's not the goal. A word on the directories and text files: There are the same number of directories as there are buildings on the map. Each building has 2 text files, some have 4 if there are two buildings too close together to tell them apart. The first text file is totalBuildingName.txt, and this holds the number of pictures there are of that building, just one number. The second file holds text, and is just BuildingName.txt, and it holds the description of the building. The main directory where ALL of the PHP files are stored is called final. it then goes up to directories, then up to the building name. So if you're in admissions, the directory is: ./directories/admissions/ As for the code: It all works fine. Of course it doesn't work completely fine, or I wouldn't be posting here. It does everything I want it to do, and possibly more, however, I can't seem to open the text files within the directory. No matter how hard I try. The permissions ARE set on the folders and files, so that shouldn't be an issue, and if placed in the same directory as the text file, fopen can be used to file the text file, and then implode it to print it out. This leads me to believe that $TheFile isn't looking in the right place, but to be honest, I can't figure out what is the correct direction. I'll be extremely thankful to anyone who can point me in the remotely correct direction. Thank you so much.
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 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:
2 Submits Useing The Same Inputs....?
I have a page that has like 50 inputs... (to create an image) so many that I want a preview button and a submit button the submit will add the info to the database like it should but the preview button will make a pop up with a new page my problem is that i need all the info sent to both pages....if they click preview i need all the inputs send to preview.php and if the user clicks submit i need all the inputs to go to generate.php how do i do this?
Form With Multiple Image Inputs
I have a problem that I cannot seem to find a solution. I'd appreciate any insight on it. I have a form with inside a dynamically created table of Images and 3 inputs of type image: echo "<form method=post action='http://localhost/processplay.php?$counter' >"; echo "<table align=center border=10>"; $counter = 1; for($i=0;$i<5;$i++) { echo "<tr>"; ..... echo "<img src=$source width=30 height=30>"; ...... echo echo "<input name=$counter type=image height=30 width=30 src=$source>" ...... ..... How can I pass to the processplay.php (the action of this form) which input was pressed? (remember that the name of the input is unknown to me before the form is created so I cannot write it explicitly).
Storing Form Inputs Appended To A .txt
Can I have people input an email address, check it that it is an email address form (something@something.something) and then add it to the end of a .txt file without modifying anything else about the text file? How can this be done? What settings do I have to place on the text file (I am on win2k iis).
Visual Validation Of Form Inputs
Is there a way of having a form post it's fields to a validation page so the user can see what they have submitted, and then click a button to submit the information to email? Instead of having validating fields in the form, I would like to just submit them to a validation page, so if the information is correct the user can then click a 'submit' button or something. At the moment I have the information from the form being submitted to email, and the validation page coming up after that. The problem here is that if the information is incorrect the form has to be submitted to email again and I recieve 2 emails instead of just one.
How To Make A Form In Php Accepting Indefinite Inputs?
I was trying to figure out how to make such a form: Data: [ ] [add][done] When I enter a data and click the [add] button, the data gets added to a list (and preferably the updated list is displayed on the same page). This repeats until I click [done] button.
Protection Against People Entering Code In Inputs
Just made my login page, but i am worried about people putting code in their usernames or when they enter anything into an input in a form. How can i combat this? i have already made the fields all lowercase to make my life easier in the database.
Keeping Values In Form Inputs After Validation.
How do you put posted values back into form inputs if validation fails. I've tried this: <input type='text' name='title' size='30' maxlength='70' value='<?php echo $_SERVER['title']; ?>' /> This causes ' ' to appear in the input box though. I have no idea why. I figure this is an easy question. I'm not the only one who doesn't want their users to have to fill in a whole new for because of one mistake and not be able to see the mistake.
HTTP Header Response For Invalid Form Inputs?
Is it necessary or is there any standard to send HTTP header status for form inputs ? Say, the user is entering invalid password in login form and now all the applications I have seen are just displaying error messages above the form (with HTTP status 200); is it necessary to send 401 status in this case?
Error Message Causing Form Inputs To Clear
My problem is this: I built a simple form that connects to a sql database and inputs the information. I made it so it puts the error message at the top of the page, when the user leaves a required field blank, password is too short and so on. The problem is that it clears all the fields when it displays these error messages. Is there a way to prevent this so it doesn't all have to be entered again. Am I just going about this the totally wrong way? I really haven't been working with php that long, about a week really, so excuse me if this is a total noob question. Code:
Quickly Adding Text To A Mysql Text Field That Is NOT Empty
Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and then insert the new string. Basically i'm looking for a way to do it with a single query not 2 (one being a select to gather existing data).
Gaining Access To How MySql Parses Text For Full Text
I want to gain access to the function or process MySql uses to parse words and phrases for Full Text searching. Here is an example. If the user inputs... Milan in history MySql will search for milan, history, and milan history. Is there a way to extract just the combination of terms MySql uses to search the db without the stop words? Stop words are automatically eliminated from the search request unless the user encloses a phrase in quotes. What I am trying to do is develop a script to highlight found search terms and phrases. I can explode a phrase into single words but if I do that the stop words would be included in the array. If there is some way of getting into the parsed words or phrases MySql Full Text actually uses to search, I can use each of those combinations as a keyword in my highlighting script. This request is about searching for the code or any code related to the questions involved.
Text Area Not Accepting Large Amounts Of Text
I have a form where teachers enter homework assignments and they are then stored in a MYSQL database and retrieved elsewhere. I have been using "get" with the form. The code is simple: <textarea name="array[assignment]" cols="60" rows="10" id="array[assignment]"></textarea> It does allow post of 100 words, etc. Stuff that teachers normally submit. What's happening is that it won't allow very large posts (over 300 words maybe? ) Not sure what the cut off is. When you press submit it won't go, or there is an error where it won't submit. Is there a limit for text fields? Since the fields scroll, I didn't think that having only 60 rows was any type of real limit, I though you could put in as much as needed. But then all of it ends up in the address bar, so there must be a limit of some sort.
Read And Display Japanese Text From Text File
I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with the same problem. The plan was to make a script to read and display japanese text. I will use it for making a japanese proverb script and for a japanese language study script. Method : I wrote a simple kanji text file (saved with UTF-8 encoding) I wrote a simple PHP script to display the file contents (saved with UTF-8 encoding) I specified the content-type header for the HTML page : <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> *** All files have the same encoding. *** UTF-8 supports japanese characters. and it works! this is my PHP (and HTML) script : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>PHP : Japanese Text File Read : Exercise 1</title> </head> <body> <?php $filename="japanese.txt"; //open file $fp = fopen($filename,'r'); //loop through each line in the file while($line=fgets($fp)) { //output current text file line print $line."<br>"; } //close file handle fclose($fp); ?> </body> </html> I know it's a very simple script, for testing purposes only. It displays the contents of the japanese text file line by line. The key was to save all files in the same encoding (I used UTF-8) and to specify the encoding / charset in the HTML header (<meta http-equiv="Content-Type" content="text/html; charset=utf-8">)
Append Text At End Of Existing Text On Same Line
I'm working on a part of my web site that uploads images, then writes the name of the image to a text file. The upload part works fine. The part that writes the name of the image to the text file works fine. What I'm trying to do is, after all the files have been uploaded and all of the image names have been written to the WriteTo.txt file, append a written description of the picture at the end of the picture name. In other words, after a user uploads their pictures to the server I want to direct them to a page where they can label each of the pictures using a form. PHP Code:
Adding Text To Text Window With A Button
I have made an admin section of a site, What i want to do i have buttons under that have "BOLD" "center" and when clicked it adds <b></b> tags to the text area etc etc.. if the text area was called "message" how would i going about coding the images / buttons to add the code?
PHP - Using Mail() And Unicode Text - Text Gets Disturbed
I have the following problem. On a website there's a (simple) feedback form. This is used also by Polish visitors who (of course) type Polish text using special characters. However, when I receive the text in my mailbox, all special characters have been turned into mess...... For example: "wspólprace" is turned into "współprace". It seems PHP is handling the Unicode-8 strings quite well (when I 'echo' the strings on the site, I see the text correctly), until the point that it is send by using mail(). Is this a server configuration issue? Or something else? How can I get my text to remain in Unicode? I have this problem both on my testserver (Apache 1.3.28, PHP 4.3.2 on Windows XP) as on my providers server (Apache under Linux).
Remove Text Header In Text File
I have been having trouble removeing two header lines at the top of my txt file. You will see in my code the different things I have tried but with no luck. Below I posted my script and data. I am doing a few other things in my script as you will notice but this is the only thing I am having troble with. Code:
Parsing Text - Capture Text Between Two Tags
I want to have text in files, such as {body} {/body} and then be able to open that file and grab all of the data inbetween those tags. I could open the file and go through it until I see the {body} tag and then store data until I reach {/body} but that is a bad way to do it.
Text Returned From DB Gets Cutoff When Placed In A Text Field
I have a string that contains an apostrophe or a quotation mark, stored in a DB. I can retrieve the data, and display it properly (for editing) in a textarea, but when I try to put the string in a text field, it get's cut off right before the questionable character. For example: $string_in_database = "John's car." -displays correctly here <textarea><?php print $string_in_database ?></textarea> and displays this - John's car. -gets cutoff here <input type='text' value=''<?php print $string_in_database ?>' /> and displays this - John I've tried adding slashes and stripping slashes and I just can't figure out what I need to do.
Keep Text In Text Boxes After Form Is Rewritten
I'm trying to make a form that does the following: (1) the user answers a question by typing in a text box (2) a response is then written below the form, saying whether the answer is right or wrong and, perhaps making a comment of some kind (3) the user's answer remains visible in the original text box I've managed to write some code that does the first two things, but despite many attempts and much searching for code examples, I've failed to find a way of getting the answer to reappear in the text box when the page is rewritten. This is my code:
Replacing Text For Use In A Text Area...
I have a PHP page that allows a user to preview an email and then send it if(s)he is happy with it. Otherwise, they can click on an edit button and edit the text of the message. The text is then shown in a textarea element. While in situation A (the preview), a bit of formatting is useful (e.g <BR>), all of this formatting is a nuisance in the textarea. Basically, I would like to do the following: a. replace <BR> with a line break for the textarea b. get rid of double spaces and tabs before the text is loaded in the textarea c. put the <BR>s back in when the user is finished with editing the message. Is there a way to do this?
Dynamic Nav Bar
I am trying to implement a dynamic navigation bar. My problem is as follows - All of my scripts are located in various folders, and as you move to different areas of the site, the links to the other areas of the site will change. For example, I am currently at home.php and the nav bar has references to admin/manage_users.php and companies/view_employees.php, etc etc. If I go to manage_users.php, I am now executing a script in the admin folder. The nav bar still has a reference to companies/view_employees.php, which would make this a dead link. There are lots and lots of directories and subdirectories that one can navigate to, so I don't want to have to write code for a nav bar every time. Is there something like $_SERVER['DOCUMENT_ROOT'] that I can use that will help?
Dynamic Variables In Php?
Hi, I have a mySQL table that contains two columns column one is 'feature' and column two is 'feature_value' - some of the data is for example 'hair_color' - 'blue' 'hair_color' - 'blonde' 'hair_color' - 'black' 'hair_color' - 'gray' 'eye_color' - 'blue' 'eye_color' - 'hazel' 'eye_color' - 'brown' Yeah I know... definitely NOT third normal form. OK here's where it gets even better On one web page, I build select controls from this data. The name of the control would be the value of the feature column. So from the data above I would have a select control whose name would be name="hair_color" and another select name="eye_color" NO problems so far.... ok. Now after the user selects from the selects (get it, sorry).... i am processing the data. Although I use javascript for some client side validation... I also want to validate in php. (ok, just because I want to ok) NOW.. the web page form will post these two variables $hair_color' and '$eye_color' as described above. But I don't know ahead of time what these variables are because they're based on data from a table....... I go the table described above and select distinct on the feature column - I will return two rows.... see below while($row = mysql_fetch_row($result_set)) { $feature =trim($row[0]); } the value of feature in the first row is 'hair_color' and in the second row 'eye_color'-- What I'd like to do.... is to take the values in the $feature variable and create a literal variable that I can test for that was posted from the form........ so for example in the first row where $feature = 'hair_color' - I want to create a $hair_color variable...... because this is a variable of the select control from the form. Then for the second row where $feature = 'eye_color' - I want to create an $eye_color variable because again... this is the variable of a select control on the form.
Dynamic Links???
I’ve looked at several tutorials and searched the archives of this site. I found a few pointers, but I feel entirely daft and can’t seem to quite get it. The “ultimate” goal is to display members profiles, and not have to hard code all the bl**dy records, as I’ve done so far. (Current version http://www.internetbonsaiclub.org/c...y/profiles.html) So, now I have the records in one table in my database. The profiles.php3 page takes all the records in that table, and displays the names in alphabetical order. So far, so good. Now, I have viewprofile.php3, which should display only one record at a time, based on which name the visitor clicked on.
Dynamic Menus
how to have dynamic menu, say one option is selected from the first menu, and that option changes the 2nd menu options. ? yeah i have seen it work in JavaScript, (onchange) but what would the syntax be in php ?
Dynamic Communication
I am wondering if there is any way to use maybe XML to mimic another sites form on my site. For example, to use maybe Expedia's flight search form on my site and then post the request to expedia and have the results format back into my site. It is sort of the same concept as xml-rpc accept I am wondering if it can be done without setting up an xml-rpc server for the response. Essentially the script would allow you to take the user through the entire search process all the while making it formatted to the layout of your site, but using Expedia's engine.
Dynamic Notification
Is there a way for me to have an email sent to me anytime one of my users creates/uploads a new file in a specific directory on my website? Sorry if this is really basic.... I'm not sure where to start. Any help would be greatly appreciated.
Dynamic Content In A <div>, Using Php
i have a <DIV> block, and I want the innerHTML to change at the click of a button. for those who don't know some javascript, if you have a dive with an id, <DIV id="myDiv"></DIV> you can change the content inside with a function call myDiv.innerHTML = "some stuff"; however, i need my data to come from a mySQL database and thus needs to be outputted via php. so ideally i want something like myDiv.innerHTML = "<?php echo "some stuff"; ?>"; of course that does not work because php is not client side, this is just to illustrate what i want. any ideas on how to do this without iframes?
Dynamic Data
I have included a php script into my page as <img src="plot.php">. That script just plot some time changing data. Now I have two questions that I cannot solve myself: (1) When I press the reload button I expected the plot reflected the changed data. Instead of that plot remains unchanged until I directly invoke the php script from the browser... Is there any method to avoid this unwanted caching? (2) That is a bit off topic but is there any easy way to get a web page updating after a certain period of time? Once solve my first question I'd like to offer mi visitors a automatically changing graphic.
Dynamic Php Tables
As you'll notice, each new result appears in a new table, which is very annoying. I am trying to make it so that all ther results appear in 1 table. This is what I have so far; <? //error message (not found message) $XX = "No Record Found"; $query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 "); while ($row = mysql_fetch_array($query)) { $variable1=$row["Model"]; $variable2=$row["Creator"]; $variable3=$row["Title"]; print ("$variable1, $variable2 ,$variable3"); } //below this is the function for no record!! if (!$variable1) { print ("$XX"); } //end ?> Can anyone help please?
Dynamic Variables
I am NEWBIE & trying to develop internal control system with PHP-MySql & have one problem. I want to enter dynamic variable into MySql like : "I have checked report of Mr. $userName from $previousDate to $currentDate…..” Wherein - $username, $previousDate, $currentDate will be called from other table. My codes : PHP Code: INSERT INTO `checkReport ` (`schID`, `schNo`, `noteNo`, `subschName`, `content`) VALUES (1, 1, 'a', '', ' I have checked report of Mr. ‘.$username.’ from ‘.$previousDate.’ to ‘.$currentDate.’ ….) which is not working… Please guide me through.
Dynamic Table
I'm working on creating a dynamic table generator. The data is read from a database via mySQL. The table sample is: Code:
Dynamic Thumbnails
ImageCopyResampleBicubic() here is a modified version of the above code that will properly handle copying only portions of images (i.e. creating a square thumbnail from a rectangular image by cropping out the square rather than smashing to fit). Also a few breaks were added to avoid some unnecessary calculations that took place under some conditions: PHP Code:
Dynamic Playlist, From URL
I have many complex ASX playlist files and would like to cut my work down managing them by having one line in them dynamicly created on the fly depending on a link the visitor clicks. Is there a pre made processor that will look in the URL for a variable, insert that variable into a pre made ASX script and return that modified ASX script back to the client?
Dynamic Form
I have one user table in my MySQL database and this is linked to a user type table containing 3 types of user. Each type of user will be required to give a different amount of data when registering. Basically I want to create one registration form for all types of users but only show the form fields that are relevant to the individual user type. The user type will be selected from a pervious page containing a list menu with the 3 user types that is sent via GET to the registration page.
Dynamic FAQ Software
Can anyone suggest some PHP software for maintaining a FAQs page? I want to include moderate user contributions, but I don't mind modifying something to get what I want. (I have tried searching for this but can't seem to come up with a search string that weeds out are the FAQs pages out there)
|