Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Form With Multiple Submit Buttons
Ive been trying to figure something out for a bit and im a little stuck on it.

I have a page with a form that on-submission passes the values of 2 hidden fields to the next page. Now however, I want to give the user a choice between 2 pages to go to, but im having trouble finding a way to pass the hidden fields to either of the 2 pages.

Right now im trying to use 2 submit buttons to do this, each one linkining to one of the 2 possible pages. Then I use the code:

Multiple Submit Buttons On Shopping Cart Form
I am using an SQL query to populate a table with product data.  The form is processed by another file.  The buttons after each item are SUBMIT buttons.  I want to have the user click the appropriate button and it sends that particular items ID value on for processing.  The only way I found to do that is to have the submit button's value be the ID; which of course displays that ID instead of a "Proceed to Checkout >" label.  I have tried a HIDDEN value inside my FOREACH loop but it returns EVERY ID not a particular one. 

Multiple Submit Buttons
I am just getting trouble in a form submission. I have two input box with values and after each one it has two submit button.
When i want to update it gives me the same value for all input boox. Check this code..

I m gettin same value when i click on update for any input box:

How To Use Multiple Submit Buttons?
I have a sort form that has two fields one to specify the row name and the data that you want to sort the database output by.
But when i input an alphanumeric letter like "X" it gives me an error:

Multiple Submit Buttons
I want to create a form with several submit buttons, i.e. button1 => do this and button2 => do that, how do i find out which button the user clicked on? PHP Code:

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:

Multiple Submit Buttons On One Page
i have a table created through echo's which display data from the database.  The database has multiple items in the thing, so i have lots of rows. Each row has a submit button on it with a different hidden ID, which is $row[0], which is the ID of the items that are being displayed.

Displaying all the data and having the submit buttons isnt the problem. The problem is clicking the button. I'm not sure how to manage the data at the end. At the moment I have: Code:

Form With Two Submit Buttons
how i can have one form with two submit buttons to perform different action ie add or delete "javascript:window.document.addfiles.submit()" each button has this javascript on it can i put for example 'delete' in the brackets and then pick up in my php whether 'delete' or 'add' was sent through the submit?

2 Submit Buttons In One Form...is It Possible?
I built a working form script that emails me the information the user entered in a css styled form. As well as a send button, I would like to have a print button, that instead of emailing me the information entered, it pulls the same result form that would be emailed to me, in a new window so that the user can view the result and then print it.

Is this even possible? And if not, what are my alternatives? As far as I know, only the submit button collects the data in the fields and puts it into the php variables and then does something with the results.

Submit And Preview Buttons On A Form
I am trying to do a little script that users can post news but before they click Submit they can click a Preview button (same as in this forum where you can preview your post before posting it)

How do I do it!!! I have tried for ages to work out how its achieved as I am sure its fairly simple.

Form Submit To Multiple Websites
What i am trying to do is submit data collected in one for to forms of multiple websites. How do I do this?

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...)

Getting Dynamically Generated POST Data
I'm trying to get POST data that was dynamically generated and I'm not sure how to go about doing this.

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:

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.

Submit Buttons
Just installed apache 1.3, and php4 on a freebsd box. was playing around with phpweblog to look at some themes and get ideas for a layout but cant seem to get past the setup.

The problem is that it makes me set a pass, when i put in the pass and click on the submit button, nothing happens. I think I had this problem before with a submit button on a form before but thought it was something else .

Submit Buttons Using Php
I'm new to using php coding. I need help with the following:
1. There is a submit button on the form and is saves information to
my database. After clicking on "Save Measurement" it redirects me to
another page in my site.

What I would like to do is change what page directs it to. Currently
the submit button redirects me to page /measure/men_measure. I would
like to be able to change this.
Please see below my page below:
<?php
include("../lib/BaseFile.php");
misc_navigation('measure/take_measure.php');
misc_auth('User_Measuring');

$query = "select * from ".DB_TABLE_PREFIX."_mes_men where user_id = ".
$_SESSION['auth']['user_id'];
$result = mysql_query($query) or die ("could not send query3");
$row = mysql_fetch_assoc($result);

foreach($row as $key =$value) {
$info[$key][$value] = " checked ";
}

if (!empty($_POST)) {
$query = "update ".DB_TABLE_PREFIX."_mes_men set ";
$first = true;
foreach($_POST as $key =$value)
{
$keys = explode('_',$key);
unset($keys[0]);
$key = implode('_',$keys);
if (!$first)
{
$query .=",".$key."='".$value."'";
}
else
{
$query .=$key."='".$value."'";
$first = false;
}

}
$query.=', filled6=1 where user_id='.$_SESSION['auth']['user_id'];
mysql_query($query) or die(mysql_error());

// update profile
$sql = "UPDATE " . DB_TABLE_PREFIX . "_user SET other=1 WHERE
user_id = " . $_SESSION['auth']['user_id'];
mysql_query($sql) or die(mysql_error());


Combining Submit Buttons
I now have 2 submit buttons on 1 HTML page, where 1 is used to Handle a File Upload (this finally works!!!), and another that is supposed to Submit comments into an Access Database. Basically, I need to know if their is a way that I can do both at the same time on the click of 1 button.

Images As Submit Buttons
I have been trying to replace Submit buttons on a form with images. For some reason it does not post the varables. What am I doing Wrong? Code:

Using Submit Buttons With $_POST
I wondered if anyone could advise further? In my script I was trying
allow the user to enter a userid and password, and when the users
clicks the login button. Pass these values passed to a method
login_user, and finally display there record.

I was hoping to display the record on this web page. I would appreicate
some advice if my scrips looks correct? I unsure about the line
if(isset($_POST['login'])){?........

PHP Dynamic Submit Buttons
I am creating a php page that when you submit 'get''s data to another page. The problem is that for each row I want a different submit button that will submit criteria specific to that row. The problem is that each submit button that is made follows the last made hidden input from that particular row. Basically what I am trying to do is make it to where which ever row I submit, will 'get' two fields from that record. I would post source code, but I don't think that would clear up anything.

Basically in short I have two different fields in each record (keys) to identify of each record. I have to reference through these fields, since there is no other way. Unfortunately, when you load the page, the way the page is written it remakes each hidden input after each record. Doing this it simply sets the ($row[field]) to the last one in the query, no matter which record you submit. Make any sense?

2 Submit Buttons On 1 Page
I have this code :

<INPUT TYPE="Submit" VALUE="Change Password" name="ChangePasswd" TABINDEX=4>
<INPUT TYPE="Submit" VALUE="Login" name="action" TABINDEX=3>

Problem : When the enter is pressed, the first submit is executed. -> "Change Password". I want that when enter is pressed that the "Login" button is triggered.

Is there a possibility to set the enter to "Login" without changing the the place of the buttons??? (if I put "Login" button before "Change Password"; Enter does the "Login", but this is no option)

Register Globals And Submit Buttons
We have developed an application with register_globals "On" and are
now trying to convert it to run under "Off".

I understand that a text field previously referred to as txtText must
now be referred to as $_POST['txtText'].

The problem we are hitting is with the PHP code that runs when a
submit button is clicked. The application currently looks like this:

<input type="submit" value="Submit" name="cmdButton">
<input type="text" name="txtText" size="20" value="testing">

<?php

if ($cmdButton)
{
echo "Text Value: ".$_POST['txtText'];
}

?>

This works great with register_globals "On", but when "Off", it is not
invoked when the button is clicked.

PHP POST Via Looped ECHO Submit Buttons
Thought this would be a easy fix, but alas, no other forum has been able to help me... I will show you the code first and then explain the issue...

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?

Submit Form Without Clicking Submit Button
I was wondering if it is possible to use something like Javascript to make it so you don't have to click the submit button on a form to make it submit, while using php and mysql. e.g. Code:

Submit A Form Without The Submit Button
Is there a way to submit a form without the submit button?  Do I have to use the javascript - document.formname.submit();

How To Submit A Form Without A Submit Button
how i can submit a form without using a submit button, i have to use this in one of my ongoing project.

PHP And Form Buttons
i display the content of a mysql table in a HTML table and the users selects a record by clicking a checkbox wich is available for each record .and at the bottom of the page i want to have 3 buttons ADD, EDIT, DELETE ... how i can do that with php ... if it's possible to use plain buttons like <input name = "button1" Type="BUTTON" Value="ADD">

Having Trouble With Form Buttons:
Trying to use an image as a button in a form and although it looks good in dremweaver, when i upload it the picture appears inside a regular button. Code:

<button class="mult_submit" type="Submit" name="Submit" value="<?=$count;?>" title="Delete">
<img src="images/delete.gif" title="Delete" alt="Delete" height="20" width="20">
</button>

Form Buttons And Prev/next
Can form buttons be used in prev/next pages? I've been at this a while and can't seem to get it. You can see what I'm trying to do here . As you can see the text link works fine but the form buttons well you get the idea.

Delete Buttons On Form Not Working
i have the following script at the top of the page and the form below on that same page. it works in Safari and FireFox on both PC and Mac. However, in IE the page just reloads and nothing gets deleted. Any suggestions? Code:

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!

Adding Checkboxes Or Radio Buttons To A Form
Is there a tutorial out there that anyone could send me a link to that uses checkboxes or radio buttons in an email form?

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.

Submit Multiple Forms At Once?
What I am trying to accomplish doesn't seem totally unique so it very likely the way I am asking the question which is keeping me from finding the answer. This is an expense report problem. I have 3 tables that make up an expense report: expensereport, erDets, and erSplits.

The reason for the 3rd table is that in some cases the employee will need to split an expense into multiple lines due to multiple projects being covered by one expense item. What I want to do is create an interface that makes it seem like the user is entering into just 2 tables (expensereport, details) so the need I have is to combine the 2 tables (erDets, erSplits) into one form -- or at least the appearance of one form. an idea I have is to have just one button that submits both forms. Could I make a button that when clicked would do the following?

1. query one: insert into erDets (form1)
2. retrieve the newly created key --$var = mysql_insert_id()
3. query two: insert into erSplits ($var,  form2)

Maybe there is a better way to accomplish this?

Multiple Submit Buton Not Working
I have this form wherein the user needs to fill up. The first field on the form is a drop down box (which was dynamically created using select stmt in MySQL). The next field is also a drop down box (the choice of the user on the first drop down box will be the condition on the dynamically created drop down box in the second) and this condition will proceed until the third field in the form before the user can actually add an information in the database.

How To Create List Of People With Yes/No Radio Buttons For Each, Then Process Form
I have a database result set with names, IDfield and a Y/N field.

How do I create the radio buttons that can then be processed easily using an
array (I assume) with an easy-to-loop-through structure?

The form would look like:

Joe Smith O[Y] O[N]
Karen Smith O[Y] O[N]
....

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:

How To Avoid Multiple Submit Button Click?
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem?

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?

Form Submit
A question is displayed and if the user types the answer and submit it, it gives the information if the question is wright or wrong and provides the link to the next question.
Now, i made few modifications to the script and show three radio buttons and where the user can select the answer and submit it.Now, after i made changes it does'nt seems to be working. PHP Code:

Form Submit
The program I'm working on is a web-based CMS (content management system). There is a large editing form where users can add/update/alter content. Several parts of the editing process however require the user to navigate away from the page. The problem is that any changes made to the main form are discarded when navigating away (something I sort of forsaw but just never got around fixing early on - bad idea). To give you a better idea:

There is the main editing form called edit_buildings.php On it there are several text fields. The form is submited to a page called edit_submit.php which does all the processing and also outputs a log of changes made, to make sure everything went through ok.

However, on the edit_buildings.php page, there are links to other pages like edit_rooms.php and edit_features.php (I'm sure you can get an idea of how this works).

Is there ANY (easy) way of having the links to edit_rooms.php and edit_features.php get the form submimted and processed by edit_submit.php and then redirected to the originally intended destination (edit_rooms.php, edit_features.php) ?

Form Submit
I wrote a php script to get user input from a submiited form. I want to display the processing result in a new customized window. How can I make the form result display to a new customized window?

PHP Form Self Submit ?
I'm try to figure out how to submit the Form Variable to Multiple Address. The basic form action is only post to single address like this, <form method= post action="abc.php">

If I want to post the same variable to more than one address when I click the submit button, like posting to folowing address:

1) abc.php
2) discuss.php
3) log.php
4) data.php
5) 123.php

Did your have any idea how does it work in php? Did anyone can tell me where can I find the tutorial teaching on this method or did your have any code sample that can share with me for reference.


Copyright © 2005-08 www.BigResource.com, All rights reserved