Dynamically Generated Form And Update Problems
In brief, in the following 2 portions of code I build a form based on data retrieved from a database. The second bit of code receives the posted data for processing and updating the database. Problem is that the update occurs for the first row of data but none of the rest. I'm using a hidden field, written in dynamically ( name="tfHiddenId<?php echo $j ?>" ) where $j is a counter var in a loop.
When I print out the POST_VARS everything is as I want to be, fields all named according ly, as above. Just the update either 1) only does one row and quits or 2) updates same row with the same data over and over ( I suspect the latter ). Apparently my counter variable is not being incremented, but only on one var, "tfHiddenId".$i , on the receiving page. Here's the code for where the form is built from the DB: PHP Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Submit Buttons In Dynamically Generated Form
I have one big form on a page, within which is a list of text fields pulled from a mysql db. Each text field has an 'update' button, which submits the main form, and should UPDATE the textfield it relates to. The problem is, all the buttons have value="Update" and I can't think of an efficient way of passing the unique id of each record to be submitted with it. Obviously, having a hidden field for each textfield won't work because the form will use the last one displayed.
Dynamically Generated Results Table
I'm trying to write a script that dynamically generates HTML tables depending on the results from an SQL query. So far, I have managed to set the HTML table headers to be the same as those in the MySQL table. [thanks to rod k -cheers !] Now i'm trying to put the results in the table. Basically, I need a MySQL function to retrieve data and put it into the table until there is no data left.... (At the moment I am using "mysql_fetch_array()", but with this it is necessary to know the names of the columns to retrieve the information for each result set. Since my table is dynamic and should be able to build itself from different MySQL tables, the column names aren't fixed and so i can't use this to put the data in the tables...)
Populating Dynamically Generated TextFields
If one assigns something to the value iattribute off an input /text field, that value will be displayed when the form is loaded. My problem is, when building a form dynamically, the only way I can get the text to show is by doing the above, however, as this is an update form, when the form POSTS to processUpdate.php, both the data entered by the user AND the data in the value attribute are inserted/updated. So, how does one dynamically build a form where the data is displayed in the text fields but value atttribute is not set. PHP Code:
Highlight Dynamically Generated Text
I have a search form which makes queries to a database. In the form the user can search for many words (word1 && word2 && word3). I want in the results to highlight the words that the user has searched for. I 've searched in the internet and i've found some codes but none of them works with all the possible results. What I have found so far which is closer to what I want is the following:
Uploading A Dynamically-generated Image
I have a script that generates an image based on users' inputs. How would I make it so that the script automatically uploads that image to a different folder on the server? I'm stumped on this one. Does anybody have any ideas?
Use Strcmp To Edit A Dynamically Generated Dropdown...
I've written a code that runs a 'SHOW DATABASES' query on my mysql server and lists the results(the names of the databases on my server) in a dynamically generated dropdown box, and it works just fine, using the following code: echo "<select name='databaseselect'>"; $dblist = mysql_query('SHOW DATABASES'); while ($row = mysql_fetch_row($dblist)) { echo "<option value='$row2[0]'>$row2[0]</option>"; } echo "</select>"; The problem is that it lists ALL of the databases on my server - that's two of my own user-created databases, and the two default databases that come with the mysql server - 'information_schema' and 'mysql'. What I want to do is to, after running the 'SHOW DATABASES' query, eliminate those two databases from appearing in the dropdown box, because I don't want anyone to see them, as they're useless to anybody else. Code:
SQL Syntax To Update Records With Diff'rent Function Generated Random PINS
I use a function, myrandomPIN (), to generate random PIN numbers. The following sql query updates records with the SAME PIN number but. I want to generate DIFFERENT pin numbers for every record. The function is ok but I can't figure out how to run it individually for each record. In other words I do not know the correct syntax to use UPDATE in a loop (if necessary) so that a different call to the function is done every time or ecah record ends up with a different PIN. Or may be this can be done with a single mysql_query($sql2)? -------------------------------------------------------------------------- $qr = @mysql_query($sqlb1) or die("ERROR"); $rs1 = mysql_fetch_array($qr); $thepin=myrandomPIN(); $sql2="UPDATE clients SET pin='$thepin' WHERE code='".$thecode."'"; $qr = @mysql_query($sql2) or die("ERROR""); --------------------------------------------------------------------------
Php Generated Form Array And Formatting For Mysql Query
As part of a form I have created I have a MySQL generated table who's fields include soccer team names, opponents, next match date, matchid etc. . Each row has a check box with the value of the checkbox being the unique row ID in the MySQL table (match id). When a user selects the teams from the list he would like more information about, the checkbox variable is parsed to the script as an array "$var[]". If I use the following code, I can see all the contents of the $Var array that has been parsed to the script. [php <? $number=count($var); for($a=0;$a<=$number;$a++){ echo $var[$a]; } ?> /php] The problem is how do I format the above output so that I can include it in a MySQL query statement? I have no way of knowing how many teams have been selected or the key index number for each variable in the array. How do I code this so that each row matchid is assigned it's own unique varable such as team 1, team2 etc? I was thinking of using a loop to go through the array and generate $var appended with a number using the the PHP count() function. but seeing that I am fairly new to PHP I'm not sure if this will work or where to start!
Dynamically Populate PDF Form
I found a free script/class online a few months ago which enabled me to populate pre-built PDF forms with data using PHP; without using any toolkits etc (it worked perfectly). It was simply a PHP script. I lost the script when my PC died recently DOH! Does anybody know where I can find such a script again? I have searched google all night, but all I find is commercial products (not cheap!) or toolkits for generating PDFs', not filling pre-built PDF forms. Here is what I am trying to do: I have built a site for a client which incorporates e-learning. Students take lessons and if at the end of the course their grades are sufficient, they download a PDF certificate. The certificate is in PDF format with Form Fields for the required data. The certificate needs to display the students name, grade and course name. I need a PHP script which can import server-side data into a PDF form which the user can then print or save (flat). The last (and lost) script did this so I know it is possible.
Add Fields To A Form Dynamically On The Fly
I'm looking to create a form the allows the user to input a simple list item by item. However I am not sure how to implement a form that allows the user to add as many fields as the need on the fly.
Link To Form Results Page Dynamically
I have a dropdown box that pulls information from a database. What I want to achieve is that when a caller selects an option, the option determines that page that comes up. I tried setting the form action to the name of the option, but this down not bring up anything; actually the resulting page is .php. I also tried moving the form action statement after ther selection, but that does not work either - the Submit button does not work. PHP 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?
Update From Form
The file below is supposed to bring up a form with the fields for a user inserted into it for editing. "edit.php?id=83" is an example of the link to it. When that link is clicked the page is empty and the is no code in the source view. <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="select from todo where id='".$_GET['id']."' LIMIT 1"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $item=mysql_result($result,$i,"item"); $description=mysql_result($result,$i,"description"); $category=mysql_result($result,$i,"category"); $priority=mysql_result($result,$i,"priority"); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id";?>"> Item: <input type="text" name="ud_item" value="<? echo "$item"?>"><br> Description: <input type="text" name="ud_description" value="<? echo "$description"?>"><br> Category: <input type="text" name="ud_category" value="<? echo "$category"?>"><br> Priority: <input type="text" name="ud_priority" value="<? echo "$priority"?>"><br> <input type="Submit" value="Update"> </form> <? ++$i; } ?>
Php Form And Update Sql
Im using a php user system from source forge and modifying it. I just want to test updating sql from a submit button. So say when button is clicked the new value either as a actual value or an addition like below can be passed to the database and then the value returned as a print or echo. if ocassionaly managed to get the value to update (i checked the sql database) but it doest work at showing the updated value and now its completely broke. Can anyone who understands what im trying to do either look over what ive got and correct or write a simple version of what I should be doing. Code:
Form Update
I have a form that sends data to mysql, and you get shown the submitted data. But i also want the users to be able to update their sent info, after thay see what they've sent, to make changes if something was incorrect. I want to make an update feature that will let them do that, but their is no user authentication on these pages, so i want to use php session. I don't know where to start. I want the form data to be saved in the session, so when they go to the update page, their info is still there. I want the session to end after they update.
PHP Form Field Update...
I am sure this has been answered here somewhere, but I have searched for a good 2-3 hours and can't seem to locate a solution. Additionally, I really don't want anyone to solve this mystery for me (at least not all the way!) - But I was hoping someone could point me in the right direction here. I am trying to figure out how to update form field information before the end user hits the submit button - for example, if they select that they are from California from the "state" drop down list, only counties from California would show up in the "county" drop down list. BTW, this is only a hypothetical example - I am only using this code to build a photo manager for my website! Anyone able to: 1) tell me what this process is called - it's hard to search for answers when you don't know what you're looking for. 2) point me in the right direction of a solution.
Form -> Array -> Update
I have a form which lifts 20 items at a time out of a db table. Against each record I place a textbox for suggested changes, and the relevant line in the form is: PHP Code:
Dynamic Form Update
I have the following form in which i need to updateitems. The problem is that i do not know how many elements will be in the form (generated dynamically) eg <input type = "hidden" name ="id1" value="1"><input type ="qty1" value ="1"> <input type = "hidden" name ="id2" value="2"><input type ="qty2" value ="1"> <input type = "hidden" name ="id3" value="3"><input type ="qty3" value ="5"> <input type = "hidden" name ="idn" value="n"><input type ="qtyn" value ="1"> how do i generate an array for a foreach loop to update the values in PHP so that i can use it to create a Update query eg ///begin loop $sql = "UPDATE `table` SET `qty` = `$qtyn` WHERE `id` = `$idn`"; // end loop
Update Database Using A Form
i would like to up date i have the following fields; Prod_ID Prod_Desc Date_sent_in_house Used_by_date Supplier Cases_sent Cases_sold Price_p from a form i would like to enter new data into the database table., but unsure on how do do this can you help?
Can't Update Mysql Table Via Php Form
I have a form that updates an item pulled from a database, but after the form is posted, it does not update the mysql database with the new info, here's what I am using: Code:
Update 2 MySQL Tables In One Form
I have a form with two fields in it. Each field updates its own table. I would like for the user to be able to enter data in either fields and the form update the appropriate tables. If one of the fields is empty then it doesn't update the table. mcat - Updates mcatTable.mcatname mtype - Updates mtypeTable.mtypename PHP Code:
Form Fields To Update A Webpage
I am trying to build this mini "publishing" system and allows the user to use form fields to update a webpage (images and text) then press a button to email that webpage to a list of emails. (spamming own userbase). I will have a webpage with php code in it and the code will pull data from the db. How can I save the file has a static html file so that I can pass it to my mail function? or can I directly pass the php page to the mail function? or what is the best way of doing this? I also have to learn how to do file upload with php aswell.
Update Page Content From A Form
I want to have a web page that uses variables from a text file as some of its content. I want another page with a form that will allow me to updated/change the variables in the text file. I have no need to add variables using the form only change the values of existing variables. Basically I want to make some content on one of my pages update-able using a form; not entire paragraphs just single words that I have laid out in a table. I have been told that I should just use something like mySQL for this. I do not know if it is necessary since I only want to do it to one page.
Update Form, Security Issue
I have to write secure update record php script, here are the complete details of the website, the website has a login system that authenticates the user, writes the session ID for username and goes on. The user can post, read msg he can also update the msgs that he had posted in the past once he is loged in. when user tries to update the msg, the script check MySql DB with select * from Msg where username = session ID suppose recorset returns msg number 1,3,5,7,9 with that perticular username. I pass the user to a page ...update.php?msg_id=1 and the user can update the stuff. Everything is working fine, Problem what if the user changes the url to ...update.php?msg_id=2 he can still update the record, what to do he has not posted msg id 2. what sort of method or code should i use to restrict him to the msg that he posted If you feel that i am using a bad method or my database structure should have a new field please let me know coz I can still make changes in DB structure as well as my scripts we are in the somewhat initial stage of the development of the product.
Displaying Information In A Update Form
I can display the information in a table. But now I need to display it in a form, so I can edit it and then upload it to the database. I have the form from my upload page, But I can not seem to get the information to appear back in it. Code:
Form Data Array - Need To Update Table
I have a form that is dynamically generated by the fields I have in a table. This table generates the navigation for my site, and I want to create a page that will allow me to reorder and hide/show and activate/deactivate the links. The form is working and I have the form generating an array based on the data collected on submit. I need to know how to break this data apart so I can update my site navigation table with the correct values. The table looks like this:
Update A Ststic HTML Form To Dynamic
I have a form which I now want to be more dynamic. The datbase tables are builtbut I cannot get the fields to populate. When a member selects an age group from the first select statement and the dates that age group are scheduled to play a match are displayed in a second select statement. When both select ions have been made the rest of the form is displayed and can be filled in and the database updated. Code:
Need To Update Multiple Mysql Records With A Single Form Submit
I have a wish list like a shoping caty based on a mysql databse where i retrieve records with php I need to update the quantity which is in a text fields : input type = text name = quantity[] value = $quantity input type = checkbor value = $id name = id[] I need to update quantities based on the primary id represented with id with a single submit.
How To Update Form Input Field Background Colour On Validation Error
I have been searching for form validation scripts for ages and all th ones that I like are far too complicated and inflexible so I decided to stick with my own which is easier to understand. The only thing I don't like which i have seen on better form validation scripts is that and fields with errors are highlighted. i can only presume that they have used php to set the background color of the input field or textarea. How would I add some code to change the background colour of form elements if an error is found? Here is my code which validates the form but doesn't change form elements colours. Code:
Have To "actions" Or Run Two Types Of Queries (select,and Update) On The Same Form?
I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a row of data, etc. then I thought it would be nice to do a select, and perhaps an update (the title of the image) on the same page. I am wondering if I am having the wrong idea. I have a form, with two submit buttons, one selects an image, and some info. the other will update the image title for the given image (id, and p). I am seeing that I have a mistake here, since it seems the update query will run as well as when the select query is run (select button clicked). this overwrites my image titles in the db. I have the wrong idea, but have not seen how to do this "right". I could use another php page for update, but I am guessing this can be done from the same page. Below is my poor code - i am not an expert programmer!!! any help, suggestions will be helpful. <?php $img = $_REQUEST["img"]; $p = $_REQUEST["p"]; echo '<div class="input">'."".'</div>' //connection files for mysql @include 'c:/php/includes/db.inc' @include 'c:/php/includes/error.inc' //***@include '/usr/local/php/include/db.inc' //***@include '/usr/local/php/include/error.inc' //@require_once '/usr/local/php/include/size_image.php'
Php Script Generated By Php
I am trying generate a new PHP file from an existing page using PHP. Currently I'm using the output buffer to capture content destined for the page, and then am capturing that output and writing to a file. The problem I am having is that all PHP scripts within the new page content are executed and the results are written to the new file, when I would like the PHP code itself to be written to the new file, unprocessed. So now I am trying to just store the new page as a string and bypass the use of the output buffer, but do not know how to store php code within a string without having it execute...
Using Php Generated Pictures With HTML?
I am able to create images with the use of the GDLIB. but I am not able to use these images together with HTML. I always get the message "headers are already sent.
How To Farmat Php-generated Table
the font size declaration seems to be ignored. Is it possible to set format for tables generated with php? <?php echo "<table border=1 font size=8>"; echo '<tr><th font size=8>Date</th> <th>IP Address</th> <th>Operating System</th> <th>Browser</th> <th>Referring Page</th> <tr>' ?>
Getting MySQL Generated Keys
I am a Java/JSP developer by trade but am currently developing a MySQL/PHP solution. In JSP when I run an INSERT statement on the db I am able to automatically get back a list of any generated keys (without having to do some sort of subsequent query to get the information). Is there a PHP equivilent of this?
Php-generated Png Transparency Issue In IE
I've been trying to get my page, which works perfectly in Firefox, to work in IE as well. one problem was getting the .png images to display properly, which was fixed by doing this: filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagename.png') but what of php-generated .png files? putting the php file as the src doesn't work. the php-generated images don't work at all in IE (but work fine in firefox). (the php-generated image uses a transparent color made with imagecolorallocatealpha. when I just use imagecolorallocate it shows up, but is not transparent as I want it.)
Generated PHP Web Database Forms
I'm still gaining experiance in developing PHP applications, and have completed a couple of projects already. This has prompted me to look for ways to reduce the development time for web enabled database applications. Every web database has basic operations such as add,delete,update and search. I have been creating HTML forms and processing the results with php code. I have managed to reduce the number of forms required by using the smarty template engine. I want to go a stage further and be able to produce the forms and the processing code purely by looking at some sort of schema file , or using "mysql_list_fields()" and "mysql_list_dbs()". Before I start my quest of many late nights of coding. Can any of you guys give me a head start by pointing me at a solution/hint.
Generated Images Not Printing?
I have a problem with IE and generated images (jpgraph). It displays them fine but it's not printing them. They appear as little red crosses in print preview. I've fiddled with the cache control headers as I thought that was it. Certainly IE refuses to cache pdf files sent using fpassthru and cannot open them in acrobat.
Server Generated PDF Files?
Heres what I need to happen now, I know how to do most of it, except the generated PDF form. - The server puts that information into a PDF file with a background of my chosing and emails it to a specified adress. (Its already set up to send the email) My issue is I dont know how to have the server generate the PHP form. How does it work? How do I position the text over the PDF automatically? I'm already donating $10 to the site, thanks to the help I received from UTAlan, Lytheum, and Waldir. Ill make it a total of $20 after this.
Image Src Generated Through Php File
I've built a custom image gallery, integrated with a database. all of the images are kept above the document root in a "media" directory (for security purposes); therefore, i am using a php script in the src attribute of the image tags to display the image in the browser. to accomplish this, i chose to use the PEAR package "HTTP_Download", which worked great and performed fantastically on my staging server. I chose to use content-disposition inline, and set caching options on. the problem, the images don't cache on a users machine. therefore, everytime the page is changed to display a new image, all of the thumbnails are downloaded once again...very annoying. let me re-iterate, these files are not being generated on the fly, simply sent to the user via php. Code:
Mail A Php Generated Page
I ask if it's possible to sent to email a php generated page as an html attachment or text file !? I have searched on google, but I find only how to send mail from php not hot to send a page. Any link, or doc is helpfull ! The story: I have a long products list, from where I select some items what I want to send as a price list to some people.
PHP-generated RSS Feeds And .xml Files
I want to make an RSS feed for my site. Obviously, it should be dynamic, so the only way that comes to mind is to use PHP to create the RSS. But then the filename will be .php. Most of the sites I see with feeds (digg, shoutwire, cnn, etc) have .xml files. How do they do this? I would like to have a .xml that is dynamic/always up-to-date.
Problems Saving Gd Generated File
I'm using the gd library to build graphs from db generated data. I can output the result to the browser with no problems, but when I try to save the image, I get the following error message.
PHP Generated Pages & Search Engines
I'm trying to get a basic idea of how well PHP generated pages can be spidered by search engines? I'm working for a company that keeps two versions of it's site at the moment. One copy run off of a database using CGI, and one copy entirely in HTML so search engines will find them. I've told them that this is just a bad idea, and far too time consuming. I'm under the impression that PHP pages can be found by search engines, am I wrong? I'm going to be running almost their entire database of products off of one file, will the search engines be able to find these if there aren't direct links to them? Any other suggestions as to how to keep their positions in the search engines (very good right now) would be appreciated as well.
PHP 5 Compilation Error: Libphp5.so Is Not Generated
I started from a clean, new system, with only SSH and Webmin. It's a VPS running on Fedora Core release 2. 1) I added my domain name to the BIND server 2) I downloaded the last stable Apache version, 2.2.3, and installed it using: ./configure --prefix=/usr/local/apache --enable-so --enable-module=rewrite make make install 3) I tested it, it worked. 4) I downloaded the last stable PHP version, 5.1.6, and installed it using the MINIMUM configuration possible (not even MySQL): ./configure --with-apxs2=/usr/local/apache/bin/apxs make make install "make install" gave me that error: ================================== [root@server php-5.1.6]# make install Installing PHP SAPI module: apache2handler /usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' libphp5.la /usr/local/apache/modules /usr/local/apache/build/libtool --mode=install cp libphp5.la /usr/local/apache/modules/ cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la cp .libs/libphp5.a /usr/local/apache/modules/libphp5.a ranlib /usr/local/apache/modules/libphp5.a chmod 644 /usr/local/apache/modules/libphp5.a libtool: install: warning: remember to run `libtool --finish /root/zzz/php-5.1.6/libs' Warning! dlname not found in /usr/local/apache/modules/libphp5.la. Assuming installing a .so rather than a libtool archive. chmod 755 /usr/local/apache/modules/libphp5.so chmod: cannot access `/usr/local/apache/modules/libphp5.so': No such file or directory apxs:Error: Command failed with rc=65536 ================================== The problem is that libphp5.so is not generated from "make". I found those related links: http://www.fedoraforum.org/forum/archive/index.php/t-23665.html http://bugs.php.net/bug.php?id=27795 Following the recommendations I tried: 1) using the bz2 version of the PHP distribution and not the gz one 2) I installed getText ( http://www.gnu.org/software/gettext/ ) because some say an included library, "libintl.so", could help. But I couldn't find that library after getText was sucessfully compiled. 3) I chomed everything to 777 in the php directory 4) I installed the last stable libtool, 1.5.22 Nothing worked, I still have that libphp5.so error. Any help would be really appreciated. And I really mean it!
Are Multiple GD Generated Images Possible On One Page?
I've been experimenting with generating PNG files via PHP and GD. All was going fine, until I tried to put more than one image on a single page. <img src="draw.php?text=Picture1"><br> <img src="draw.php?text=Picture2"><br> <img src="draw.php?text=Picture3"><br> The example above produced 3 images, but they all have 'Picture3' on them. Seems like theres only 1 temp storage area for the images?
Strange File Auto Generated?
I am using Linux/PHP4 + Smarty, sometimes I found some strange file auto generated under the temp folder for smarty cache, e.g. phpNd7W05 Anyone know the reason for this file?
|