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




Dynamic JS Form And $_POST Array


I have a form that I am altering after page load with javascript. Basically I have a button that inserts another text field into the form which the user can fill out. Its for a calendar, and I'm allowing them to optionally add multiple days for an event. Each box that is created has the same name with [] on the end to make it an array.

When I view the post array with print_r($_POST), only the first textbox's value shows up. This is the only textbox in the form when the page loads.
Simplified example:

<form name="calform" action="process.php" method="post">
<input name="startday[]" type="text" class="bordered" size="25" />
<input type="button" onclick="add_one_more()" value="Add another date" />

// if the user hits the add button it adds this input field after pageload

<input name="startday[]" type="text" class="bordered" size="25" />

</form>
And here's what I'd get from that form

Array
(
    [startday] => Array
        (
            [0] => test1
        ))

A button inside the form basically adds another <input> tag between the <form> tags. Why isn't PHP seeing the data?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic $_POST -
I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:

$abc = $_POST['abc_' . $value]; //isnt working as is

If $value had a value of 44, the above code would be represented as:

$abc = $_POST['abc_44'];

As I require that the line be quite generic to whatever the value of
$value is, I need to do it like the first snippet. What is the correct
way of writting this?

PHP Dynamic $_POST Or $_COOKIE Variable
Ok guys the premise of this was to dynamically retrive either a $_COOKIE or $_POST variable depending on which exist.

I thought it was simple and was simply using a variable called $element_type

the idea is that $element_type is either "$_POST" or "$_COOKIE"

So you would think the code $type."['FormName']" would work and retrieve either a cookie or post value .......but it doesn't. I've tried using an eval on it but I always get a parse error because of the square brackets (without eval the best I can get is literally the text $_POST['somevariable'] which is of course useless.

$_POST=array();
In the text I am reading it says that $_POST = array(); will see to it
that a form does not retain any values. That is understood. My question
is what does this code normally do / in which context is this code
normally used? I realize that this is an elementary question....

The $_POST Array
I got the following code:

reset ($_POST);
while (list($key,$val) = each($_POST))
{
echo "$key => $val
";
}

But this prints out nothing. If I replace the code above with:

print_r ($_POST);

I can see the content of the $_POST array. Why?

Help Please With Printing $_POST Array
How can I display all of the variables held in the $_POST array on my web page?

For example:

$_POST Array Errors
I am having a problem with some code that uses $_POST, so I wrote the following code to debug the problem:

$num = count($_POST);
echo ($num);
for ($idx=0; $idx < $num; ++$idx) {
echo("$_POST[$idx] <br>
"); }

Notice: Undefined offset: 0 in C:InetpubwwwrootToDoListedittask.php on line 38
Notice: Undefined offset: 1 in C:InetpubwwwrootToDoListedittask.php on line 38

So there are clearly 8 elements in the array, which is what I expect, but for some reason I cannot access them?

Reading An Array Of $_POST
My forum is setup so it dynamically posts 1 or more direct deposits depending on how many the user enters. The problem is it is only writing the first $POST to mySQL and not the subsequent ones. Do I need to store all the same $_POSTS[same name] in an array or can I do a $_POST[same name] +new_Count. 

Can i do this without using arrays, how does the $_POST variables. Look at my psudeo code to see what I mean, the syntax is right at work, but this is the best I can remember at home. Code:

Globalizing $_POST Array Variables
I'm trying to come up with a function that will globalize each element in the $_POST array, effectively mimicking the php.ini 'Globals = On' setting for the $_POST array.

So far I've created a minimal recursive function that takes an array as argument, parses each element in the array and checks if it's an array or not, if it is an array it's passed recursively back to the function, otherwise the element is made 'global'. The function looks like this:

Can You _POST Variables In Php Without Using A <FORM>
The question I have, is it possible for a php script which is used to
validate values submitted in a form, to then post these values onto
another script/page or even back to the calling form?

i.e. the application I have in question is a login.htm page with a
verify.php script The login.htm has a Form which captures login_id and password which are posted to verify.php

verify.php checks the id and password against the database.
if the check succeeds I use $_SESSION to track the logged in user into
the page. if the check fails, I use $_SESSION["error"] to set an error message
and then jump to login.htm, but I've lost the userid.

The only way I can see of transferring the userid (and some other data)
is by calling header ("Location: login.htm?id=$uid");
and then have some php code in login.htm to $GET['uid'] and pop that
into the user field on the form.

Is there any easy way I can post this data back without using a <FORM>
or at least a form that can be auto-submitted?

Getting Form Values Without Using $_POST
I just started supporting my first php app, and am attempting to set up a development copy locally on my pc. In some places in the application, forms are submitted and the values retrieved w/o the use of $_POST['inputname'] (the form method is post.)

This works on the production site, but not locally. I've made sure the php.ini is the same, and I can't find any other hints as to why this might be. Using PHP5 w/ Apache 2.

I don't want to have to modify a bunch of working code I'm not yet familiar with to get it to work on my pc, thought maybe this would be a no-brainer for the experts. Sample code below. Code:

Checkboxes, $_POST Array, And Switch Statement
I'm having problems with a switch statement that is wrapped in a
foreach statement so that each index in an array is evaluated against
the switch statement. The switch/case will then return some output for
display.

I have a long list of classes for the upcoming semester. Each one has a
checkbox to the right that has the following code. <input
type="checkbox" name="course[]" value="i"> where i increases linearly
with each class, i.e. first class value="1" second value="2". There are
41 classes for the semester. Upon submission of the form (Yes, I have a
<form> tag with all the necessary parameters.), display.php (the action
of the form) should loop through each key in the course array and
evaluate the value against a switch statement. Here is what my PHP code
looks like so far:

if(isset($_POST['course']) {
foreach ($_POST['course'] as $key => $value) {
switch($value)
case 1:
echo 'foo'
break;
case 2:
echo 'bar'
break;
default:
echo 'Please select a course'
break
.............

I tried putting the case numbers in quotes like

case "1":

but that didn't make any different. What this will eventually do is
pull book information for each class that is selected from Amazon and
enable the user to quickly add the books to a shopping cart and check
out. I shortened the code (leaving out the other 39 cases!) and I
omitted the html that the PHP page contains. Can anyone explain what I
am doing wrong with my switch statement and/or array?

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];

Getting $_POST Variables From Form In A Function
I've loaded various thoughts I've collected into mysql. I want to write an
app, all in one file, that has the following features:

1. On initial entry, selects and displays the thoughts ( might add
pagination later - there aren't alot of records, for now.)
2. This main page includes separate forms near the top with submit buttons
to search, add a thought, view all thoughts, etc. The action for each form
is to call this same page. The submit buttons and thoughts are printed from
a function.
3. In the main logic, I am trying to do a $_POST and if isset() on each
submit button name and then call a corresponding function, do whatever it
has to do, unset the form variable and continue back to the main display.

The problem is that it's not calling any functions. The error log says that
the name of each submit button in my $_POST[] statements in the main logic
is an undefined index. I presume that they are undefined in the main logic
because the forms were defined in a function.

Is there anyway to access, in the same page, form variables that were
declared in a function on that page?

$_POST Form Variable And Use In Same Php Page
Apache/2.0.48 (Win32) PHP/4.3.6

I would like to take a value from a checkbox(checked or unchecked) and
then use that value in a php script All on the same page. So I should
post the form to the same page right?

And then pick that variable up via $_POST or $_REQUEST methods right?
I have tried various approaches to the action= clause of the form but
to no avail. I know how i did it in asp but it doesn't seem to work.

Using Session $_POST On Form Submit
having a little issue with a form submit which im hoping someone has the answer to, anyone who can help me solve this I will give $10 via paypal.

I have been using Session Variables for sometimes in Dreamweaver, I dont really hand code that much to be honest, so thats why i need your help. I have quite a large form which has around 25 textfields, checkboxes and Drop Down fields etc, also mutiple file fields for photos, my current issue is that the user sometimes gets a Timeout when uploading the files, when the user uses the 'Back' button all data is lost.

I know it is possible to store all information into session variables just when the user submits the form. I have looked at examples on this forum and the web but found only snipplets Okay....What I really need !

An Example of a basic session, storing the variables to the Server as soon as User has press Submit on the <FORM>, it wouldn't really matter about IF Statments to check if the session exist's, if you could so an example that would be great.

Dynamic Form Fields/multiple Page Form?
It is for a friends out of print booksite, where visitors can request multiple books to be searched by adding one at a time to a cart (javascript), then once all added they submit to another form where they enter their personal details and all is sent through. The problem is at the moment they cannot change whats in the cart without refreshing the browser window and losing everything.

1) present for asking how many books they want to search for
2) display multiple rows of the same input fields depending on how many books they say they want to have searched for?i.e

title|author|publisher|etc
title|author|publisher|etc
title|author|publisher|etc

3) when these are submitted they could see these above the next part of the form where they enter their details with the option to go back and delete/amend.
4) send all the info to my colleague.

if so has anyone seen a similar script that I could take a look @ to see if I can hack it to suit my needs?

How PHP $_POST Gets The Multiple Values From A HTML Form?
I am try test a simple HTML form with PHP

<form method=POST action="testing.php">
Cat <input type="checkbox" name="pet" value="cat">
Dog <input type="checkbox" name="pet" value="dog">
Pig <input type="checkbox" name="pet" value="pig">
<br>
<select name="dates" multiple>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

When I checked cat, pig and selected Tuesday and Saturday from the form
and click submitt

My testing.php is

<?php
$pet = $_POST['pet'];
$dates = $_POST['dates'];
print_r($pet);
var_dump($dates);
?>

The $_POST['pet'] and $_POST['dates']
are NOT return as array nor multiple
strings seperated with a comma.
It only return the LAST string I have
checked and/or selected.

How do I get the multiple values from the
checkbox and the multiple select from a
HTML form in PHP?

How Does PHP5 Process POST Data In Creating $_POST Array?
I need to save a wav file that is HTTP POSTed to a php page.
What does PHP5 do automatically to a POSTed variable when it puts it in
the $_POST[] superglobal array? I haven't been able to find any info on
this....

I have a script that does what I want in PERL, but I need to do it in
PHP.
I think the PERL does something magic when it does this:

#### PERL CODE ####
read ( STDIN, $buffer, $ENV { 'CONTENT_LENGTH' } );

@pairs = split ( /&/, $buffer );

foreach $pair ( @pairs )
{
($name, $value) = split(/=/, $pair);

$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$FORM { $name } = $value;
}
#### END PERL CODE ####

Cannot Read Information From Form Using POST Or GET ($_Post Is Empty)
I am having problems in my php code. I am relatively new to php but I
know some basics.

This is the problem:

when i try to echo some information that is typed into form back to
the screen i get absolutely nothing. It seems like $_POST['name'] is
an empty string, along with $_POST and $_GET['name'].

I looked around to see if someone else had the same problem and found
that some people's code didn't work because of IE6. but i also tried
mine on Netscape and i got the same problem.

So why is $_POST empty after posting information. Even $_GET was
empty.

all of those returned empty

echo $_POST;
echo $_POST['name'];
echo $_GET['name'];

here is the code:
the code was originially meant to send an email but i commented the if
statement out to see why it wasn't working

<html>
<head><title>Feedback</title></head>
<body>

<?php

// Handle POST method.
//if ($_POST)
//{

$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

// Compose simple text message:
$message = "Message from $name
($email)

Comments:

$comments";

// Send message to bob@microsoft.com
mail("email@email.com", "Feedback", $message);


Repeat Form Field Based On $_POST Data
i have a script that sets up a second page with multiple select boxes. the first script has a hidden field for the ID number, and a text input field for quantity. the second part of the script has a foreach loop that gets the info that goes with the ID number and then creates the select box next to it. for the most part it's all working correctly, but i don't know how to get the submitted "quantity" to repeat that ID number (and everything else). here is the initial form: Code:

Dynamic Array
Say I have a function that is used to open different flat-file databases and read them into arrays. The databases have a different number of field indexes, with different names.

Is there a way of creating an array within a generic function, but with the field indexes as keys instead of just numbers?

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 Form
I need to create a form that takes a number that the user enters, and
duplicates a question the number of times the user entered. For
instance, if the customer enters 5 on the first page, when they press
next the form generates "How old are you?" 5 times on the page. The
customer will answer all 5 questions then press next. Finally, all the
local variables get dynamically created and written to a database.

I have already taken care of dynamically creating the question five
times. Using a simple WHILE clause, this generates the correct number
of questions. What I am having an issue with at this point, is how to
dynamically create the local variables.For instance, for the question
"How old are you?" I would need a unique variable for each instance;
using something like $Age(n). So that for five times, it would
automatically created variables $Age1 through $Age5. I have carried
over the number to the submit page by creating the variable $Number
and passing it along as hidden button on the form. $Age'$Number'
seemed to work for creating the variable, but $_post["Age'$Number'"]
doesn't work for referencing the global variable. I would need some
way of looping through and dynamically creating the variables.

Dynamic Form
I had to make a form for someone, with 42 questions each question had different form-elements. I was typing and coding for almost 3 hours..!! lets say we would make a form (formmaker.php) to dynamicly create a form with multiple questions: on the formmaker :

-first we have to enter the number of questions (max 100)
-then we have to type the question(s) in (an) input field(s)
-then we would have to select a type of answering field (textbox, checkbox, radiobuttons, file, dropdown etc. )

-it would be nice if we could select to make the question mandatory or not.
-if we choose for checkboxes or radiobuttons , it would be nice to know how much of them (no limits here !) ok..limit it to 30

-when we have selected...for example..15 checkboxes, they have to dynamicly appear on the formmaker.
-for each checkbox or radiobutton, we have to enter a value.
-finaly we have to add an email adres to each question !!! (and a BCC field) (this way, we can use one form and split and send the data to multiple recipients..!!)

-also we have to be able to dissable or enable a question. (if dissabled, it wont show on the created form..

A nice template to show a filled in form is preferable.. It would be nice to store everything in a database tabel. (for each new form a new tabel in the database) question1 id active(yes/no) questiontext fieldtype mandatory(yes/no) radio_or_checkboxvalue1(rocv1) rocv2 rocv3 rocv4 rocv5 etc.... sendto_email bcc_email
I started with the code already...here it is: Code:

Dynamic Drop-down List In Array
Q. How do I create a dynamically-generated drop-down list for use in
an array.

I'm using PHP with a MySQL database (through phpMyAdmin)

My database table is called com_courses, and I want to pull the
distinct 'title' fields and have them appear as a drop down menu for
the user to select in a form.

Here is my array, with (at the moment) manually-entered 'titles'
(which I now need to be dynamically generated from my database field:
'com_courses.title'

array (
"coursetitle",
"Course Title:",
$EXTRA_SELECTLIST,

array ("Report Writing", "Recruitment & Selection", "Presentation
Skills", "Essential Telephone Skills", "Time Managememt", "Customer
Care", "Other"),
0
),

I am not an experienced programmer, but can play around with php to
customize programs. I've read up on arrays (I bought a "Programming
with PHP and MySQL" book, but it just stops short of this problem). I
can't figure this one out.

Adding Dynamic Values To An Array
I am having a problem adding dynamic values to an array. The values that I want to add to the array are sent via a query string. The array is stored in a session.

the variables are sent like:

?var=test1
?var=test2

How can I send these variables to an array. I tried doing it like this:

$_SESSION['varList'] = '"'.$_SESSION['varList']'",'.$var;

but this only creates one entry in the array which is "test1","test2"

Dynamic Form Value Modification
I was wondering if and then how to dynamically update form variables without having move between webpages

I am developing a print quoting system for a company and I want the options in list boxes to adapt based on the values of previous selection in the form. However it must happen immediatly without the whole page having to refresh.

For example if a person chooses paper size to be A4 then the next drop down list must only have options available for A4 pages.

I thought I would need to use Javascript for this but I can't find out how to access the server side mysql database so I get the feeling Javascript is the wrong option.

The whole site is programmed in php but php is server side so I don't don't think its possible using php specifically.

Dynamic Form Selects
How do you make dynamic for selects in php? It is in regards to a modify type scripts im writing in php/mysql.

So regular select drop downs look like so:

<select name=genericselect>
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

right, well if I was pulling info from a database, how would I make is so that the 'selected' value is dynamic and comes from the database? Im sure theres a simple way of doing this.

Getting Info Out Of Dynamic Form
I am using the following code to produce a dynamic form.

$result = mysql_query("SELECT id,weight,date FROM weekly_data WHERE
weight IS NULL AND subscr_id = '$toss' AND date <= now()");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
print"<table width=ď`%' id='catchup' border=&#390;' cellspacing=&#390;'
cellpadding=&#390;'>";
print "<form name='form1' id='form1' method='post'
action='catchupprocess.php'>";
print"<tr>";
print"<td></td>";
print"<td>Weight</td>";
print"<td>Date</td>";
print"<td>Waist</td>";
print"<td>Measure</td>";
print"<td></td>";
print"</tr>";
while ($row = mysql_fetch_array ($result)){
//echo $result;
print"<tr>";
print"<td>";
print"<input name='".$row['id']."' size=&#394;' type='text'
value='".$row['id']."'/>";
print"</td><td>";
print"<input type='text' size=&#396;' name='weight".$row['id']."'
value=''/>";
print"</td><td>";
print"<input type='text' size=&#3910;' value='".$row['date']."'/>";
print"</td><td>";
print"<input type='text' size=&#393;' name='waist".$row['id']."'
value=''/>";
print"</td><td>";
print"<input type='text' size=&#396;' value='$measure'/>";
print"</td><td>";
print"<input type='hidden' size=&#3910;' value=''/>";
print"</td>";
print"</tr>";
}
print"<tr>";
print"<td>&nbsp;</td>";
print"<td><input name='Reset' type='reset' value='Reset'></td>";
print"<td>&nbsp;</td>";
print"<td><input name='submitcatchup' type='submit'
value='Submit'></td>";
print"<td>&nbsp;</td>";
print"</tr>";
print"</form>";
print"</table>";
?>

Form With Dynamic Questions
I've a mysql table where i stored a list of questions. My php script
executes a query which yields a different number of questions every time; i
used the loop function to create an input field for each question in the
form; and dynamically referencing each input name with the question number
i.e. question 1 is called q1, question 2 named q2, and so on.
The data is submitted using POST. I then try to retrieve all the answers by
doing a loop and using something like echo '$_POST['q'.$n.'']' except the
syntax doesnt seem to work.

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

Dynamic Form Items
I am trying to create A form that its fields will depend on a
form menu.
for example.
/***********************************************/
<form name="form1" method="post" action="">
<select name="select">
<option value="1">option 1</option>
<option value="2">option 2</option>
<option value="3">option 3</option>
</select>

Text field 1<input type="text" name="textfield">
Text Field 2<input type="text" name="textfield2">
Text Field 3 <input type="text" name="textfield3">
Text Field 4 <input type="text" name="textfield4">

<input type="submit" name="Submit" value="Submit">
</form>
/***********************************************/
When the option 1 is selected only the textfields 1 and 2 to appear,
when option 2 is selected only textfields 1 and 3 to appear and so on... any
combination I would like.

I tried puting the textfields in "if" statments but i don't like it. its too
messy PHP and HTML code.
Any Ideas of how this could be done better ? If someone did something
similar before and has a relative link it would be good as well.

Dynamic Form Pulldown
I'm building a form and need to have the options in a pulldown menu pulled from a mysql database, i understand the basics of sql and have used forms before, i just need to see an example to get me on my way.

Dynamic Form Processing
Im writing a script for processing a form created by a csv file. this form is created through a loop, where $num is the place in the loop. Code:

Dynamic Form Fields
I want to have it setup so when the user clicks this link a value is sent via get and that value is put through a for loop to generate an additional form field: Code:

Dynamic Form And $_REQUEST
My current project needs to run on both windows and linux. I figured out that windows needs $_REQUEST to read the form elements. This worked well until parsing a dynamically built form with checkboxes named: cb0, cb1, cb2, etc.

I can't figure out how I can use $_REQUEST to read the form elements, when I try $_REQUEST[$i] for example all values of the array elements are 'cc'. No idea where this comes from as cc is never used as a value?

Problems With Dynamic Checkbox - Need To Create Array
The problem I have concerns a dynamically created table/form which pulls in results from a user search of a mysql database. This works fine and pulls in results (title/author/isbn/price) and dynamically creates the table dependent upon how many results are found. For each result there is a dynamically created checkbox, which is bound to a unique field from the database(in this case isbn).

My problem then is: the dynamically created checkbox submits an isbn value to the next page - an order form. However I need that a user can select a number of checkboxes from the table. At the moment, each selection overwrites the other. It may be vary obvious - but I need to work out some way of storing the checkbox info in an array that gets submitted to my order form page.

at the moment the code for my checkbox within the html form is:


<input name="isbn_input" type="checkbox" id="isbn_input" value="<?php echo $row_Rs_panozzo_search['isbn']; ?>" />
</font></td>

This works passing one value through to my order form, but I need to set it up so it passes multiple values.

Dynamic Drop-down List With Array - Question
Can anyone out there give me a pointer regarding creating a
dynamically-generated drop-down list connected to an array?

And is that question as clear as chocolate spread?

Here's what I've got. I'm using PHP and MySQL database. I'm customizing
some calendar software, and I want the user to fill in a form by
selecting a title from a drop-down list, generated by my MySQL
database. However, the program I'm customizing uses arrays, which is
where I'm stumped.

What do I need to add to this code to make the array of titles(eg
"report writing" etc) come from my database, rather than the
manually-entered values that you can see here.

The field I want to pull from is called com_courses.title

array (
"coursetitle",
"Course Title:",
$EXTRA_SELECTLIST,

array ("Report Writing", "Recruitment & Selection", "Presentation
Skills", "Essential Telephone Skills", "Time Managememt", "Customer
Care", "Other"),
0
),

I hope it's not cheeky to ask this,
BTW I bought a book on Programming with PHP and MySQL, but it doesn't
answer this question,

Form Field Dynamic Population And PHP
I have a form that dynamically generates a drop down from a table column called suppliers.

Products supplied by each supplier vary so what I want to try and achieve is that once a supplier has been selected a second drop down on the same page is populated with data from the same table / different column with that suppliers products.
(I am trying to avoid refreshing the page)

I have not supplied any code at this stage as I am not sure whether PHP is capable of doing this by itself or whether javascript would need to be incorporated.

POST Form To Dynamic Page Name
I've got a simple form with an HTML OPTION block. I'd like to POST the
form to a page whose name is based on the OPTION they select.

So for example say the user selected this option, I'd like to POST the
form to a page named "memory.php".

echo "<option value="memory">Memory Utilization</option>";

Reset Dynamic Search Form
i have a search form that has a set of checkboxes and a set of select boxes.  the checkboxes correspond to a select box and activates the select box once checked.  when i submit the search form to display the results on the same page, the elements are echoed back into the form so the user can see what search criteria he/she search for: Code:

Identifying Dynamic Form Fields
User goes to page which is a form that asks for some basic info regarding returning products for credit/exchange, and also asks for how many products are going to be returned. Upon submitting, a return authorization form is presented to them with the specified number of product fields. I now want to take the input from this form and email it to myself, as well as, display a confirmation page to the user. The problem I have is a can't say, for instance, echo "$field_name"; because field_name will get created dynamically after the user specifies how many products to return. For example, say the user says 5 products, this will generate a form with field names like:

return_code0 inv_num0 qty0 product0 cre_exch0 stockout0
return_code1 inv_num1 qty1 product1 cre_exch1 stockout1
return_code2 inv_num2 qty2 product2 cre_exch2 stockout2 and so on....

These get created with a for() loop. Once this form is submitted, how can I address the field names? Code:

Dynamic Form Option List
I want to create a dynamic drop down option list in a form, but I just can't wrap my head around this.

Both of the below scripts work as intended, but how do I make the mySql query results work with my existing script?  Yes, I know I must replace the "$options = array" part in the top piece of code, but I need a little more guidance than that. Code:

Dynamic Form - How To Set Values Of A List
I have a form with a list/menu in it that is populated with records from a database. The items in list#2 are based upon what is selected in list#1.

I have been able to use a combination of php and javascript to get it to work, but the javascript reloads the page to get list #2 to refresh - and that clears out any other fields that have been filled in. Instead of javascript being called for the 'onchange' event for list #1, I'd rather it call php when list#1 is changed and so reset the values in list#2.

OPTIONS:
1. I thought I could have a php function that is called (i.e.   onchange="<?php reload();?>" but I can't figure out how to set the values of the list from within the php function. How to reference form objects with php?

How To Process Dynamic Form Field Names
Let me start by saying I don't have a lot of PHP experience, and am just starting to fumble my way around some of this stuff... I'm sure this has been asked a number of times, but after 2 days of searching the internet, I just haven't found a solution that makes sense, so I am hoping someone here can help me.

I have a pretty simple project schedule sort of web page that lists a number of tasks & 4 dates associated with each task. (planned start, planned complete, actual start, actual complete.

The page is built dynamically based on what is in a mysql database, and the dates listed are form fields, with the intent that a person with access can change any number of these dates.

Each task has an id associated with it, so when i build the form, I name the form field <task_id>-<date type>. so, for example, for task id = 10 I have 4 related form fields:

10-planned_start
10-planned_complete
10-actual_start
10-actual_complete

This basic pattern is repeated for all the tasks (up to 100 right now, but it could grow slightly).

Once all the form fields have been updated, and the user clicks submit I want to update the data in the database with the appropriate data.

So, my questions is:

1) How can I process this form, when I don't know what the names of the fields are going to be, and/or how many fields there are?

2) Is there a good way to identify only those fields that have changed and do updates on only those fields, or am I "stuck" updating all the records, even those where the dates have not changed from when the form was built?

How To Get A Dynamic Javacript Form Variables Seperated In PHP
PROBLEM: I have this form that allows the user to dynamically create
additional fields (see javascript code bellow). I am trying to retrieve
the values entered into these fields from my php script. I ultimatly
need to pick out the variables and place the values into my php script
page. I have worked with a little code I found on php.net (see php code
below), but I wan unable to grasp the knowledge on how to seperate the
variables in the address bar. Please reply.

QUESTION: How do I create variables in my php script from my dynamic
javascript form?

PHP CODE:
foreach($_GET as $name => $value) {
print "$name : $value<br>";
}

JAVASCRIPT CODE:
<HEAD>
<!-- Begin
function createForm(number) {
data = "";
inter = "'";
if (number < 16 && number > -1) {
for (i=1; i <= number; i++) {
if (i < 10) spaces=" ";
else spaces=" ";
data = data + "URL " + i + " :" + spaces
+ "<input type='text' size=10 name=" + inter
+ "url" + i + inter + "'><br>";
}
if (document.layers) {
document.layers.cust.document.write(data);
document.layers.cust.document.close();
}
else {
if (document.all) {
cust.innerHTML = data;
}
}
}
else {
window.alert("Please select up to 15 entries.");
}
}

Dynamic Form Option Diapearing On Submit
when i submit one option field after inserting a option value and an amount the previous one i had done disappears causing me lose all the information that i had typed in and i was wondering how i could keep the information alive as well as keep the newly created form fields from diapearing, PHP Code:

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:

Dynamic Fill Form Fields Depending On Dropdown Box
This question has probably already been asked, but let me ask again

I have a mysql database to which I connect with my php scripts. The
database contains articles. Name, Unit_Price and Reference

Now my client needs to order 5 items, click a button and a table with 5
lines and 3 columns appears (until now easy)

In the first column is a drop down box with a <select > and <options> in
which I store all possible names.

I would like than whenever the client changes one of the boxes (in my
case there are 5) the Unite_Price column and Reference column in the
line he just choose get automatically updated


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