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




Retrieving Contents Of Select List On Form Submit


On an HTML form, I have a select list that is fed dynamically with
detail records when the master record is displayed on the form.

There is also a second lookup list, and want to allow the user to
dynamically select from this list and add to the first list. I also
want the user to be able to dynamically remove from and reorder the
first list. I think I can do all of this with JavaScript.

The question I have, is how can I retrieve the contents of the first
list when the user submits the form? I need to get it back into a php
array so I can update and add the proper database records.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Retrieving Full Entry From Multiple Select List
I have a list box with multiple selects. I define the name as numList[]. I
get the values from

$picked = $_POST['numList'];

It retrieves values for all those selected.

If the entries are, say,
First
Second
Third

and the first and third are select then $picked[0] has "First" and
$picked[1] has "Third".
If, however, the entries are:

First one
Second one
Third one

Then the values are for $picked[0] and $picked[1] are "First" and "Third"
respecticely.
How do I retrieve the entire value and not just the first word?

List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

From List: Retrieving Most Recent File
From a directory listing can one retrieve the most recent file?

From the timestamp of creation or even last modification can you read the lastest file?

Multi Select Combo Box - Retrieving Data
I have a combo/listbox with "multiple" enabled in an HTML form and pass this to a PHP script, I should be able to access each item as $array_name[0] etc?

Thats what my book says and what I've been able to track down on Google seems to agree, but the only element I seem to be able to retrieve is $entry_select[0] (from the form below) which contains the last value selected in the combo list. Attempts to select $entry_select[1] just result in nothing printed. Code:

List Db Contents
can someone help me make a script that will list the information in one colum in my table! See each clan I have has an ID, and CEO and bla bla bla! But what I want done is it to only show the name of the clan in A dropdown menu. So that when users are signing up they can select the clan they want and it well ya you know puts the name beside theres in the table. But can someone make me a script to list all the clans Names and only names not ID, Ceos, and all that other stuff. Code:

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:

Accessing The Contents Of A SELECT (multiple) Array?
Simple I would guess but since I've never used one of these I'm not sure how to get at it:

PHP Code:

<select name="chooseConcert" size=2 multiple>
<option value="Conversations">Conversations (September 12, 2002)</option>
<option value="Karla">Karla (various dates in October /Nov)</option>
</select>

I need to somehow determine (and print out) the contents if BOTH options are checked. I'm getting the contents using"

$HTTP_POST_VARS['chooseConcert']

I tried it once with both options checked and it only returned the second value. So what's the syntax?

Select Box That Needs No Submit Button
where can I get Java Scipt for making the following: When the select select box value chaenges go to next page with out a submit button. I am searching google and yahoo but not hitong any, may be my search word is no good.

I know the comman goes like this:

"<select name="select" class="textfield" onchange="call (java script)">"

I need the java example.

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.

Getting Right Order Of <option>s In <select> After Submit
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.

Basically we have a list of available articles ("availableItems") and
a list of articles already in an issue ("selectedItems"). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move items
in the "selectedItems" list around so that they can be re-ordered
(i.e. I want the customers to be able to change the order in which the
articles appear in the issue).

I can do both these things on screen (i.e. I have written Javascript
to move them from one box to the other (add/delete them from
"selectedItems") and to move individual articles up or down the list
of articles in the issue. Befor submitting I run a Javascript loop on
the list to select them all, from top to bottom. On screen it always
selects them in the right order (i.e. top to bottom, no matter whether
I have changed the order of these items) but when I grab the array
containing the item id numbers it's as if the change in order had
never happened!!!

Newly added or deleted papers get added/deleted fine, but when I fetch
the array from "selectedItems" I always end up with the items in the
same order, with the latest items added at the end. However, being
able to change the order of these items is crucial for this project,
but so far I have been unable to do this and I haven't found any
information on how to grab the new ORDER of items.

Here's some of the code:

I retrieve the array like this:

/*
$ia_items_new = $_POST['selectedItems'];
*/

However, this still lists the items in the OLD order:

/* if ($ia_items_old) {
foreach($ia_items_old as $key => $value) {
//echo("<BR>Old: No.".$key." - ".$value);
}
}
/*

Populating the "selectedItems" box:

/*
print( " <td><select multiple size=&#3920;'
" );
print( " id='selectedItems'
" );
print( " name='selectedItems[]'>
" );
//Grab values if the information was found
$in_total_count = $objRSIssueBatord->RecordCount();
$counter = 0;
if ($in_total_count > 0) {
//Now put in an entry for every value in the batting order list:
//Get the recordset ready and extract data:
$objRSIssueBatord->MoveFirst();
while (!($objRSIssueBatord->EOF)) {
$counter ++;
//Get the variables and make string to describe items
$in_paper_id = $objRSIssueBatord->fields("bip_paper_tracker_id");
$is_jsp = $objRSIssueBatord->fields("jsp_code");
$is_customer_no = $objRSIssueBatord->fields("pap_customer_no");
if (!$is_customer_no) $is_customer_no = "N/A";
$is_author = $objRSIssueBatord->fields("pap_author");

Retrieving Form Data.
I have two scripts - common.php and edit.php. The working is that common.php contains a form that is used initially for registration and later used again so that registered users can edit their information. edit.php contains the connection to the db to update the form with the current users information. PHP Code:

Select List
I'm creating a form that has three select lists. The first one has two values EMAIL and SMS. What I want to do is have the two other select lists (named EMAIL and SMS) work so that if EMAIL is selected only e-mail select list can be altered and vice versa with the SMS.

How can I do this? I know to use disabled in <select> -tag, but how can I check the what the value is (and the value changes) and then act acording to it?

Retrieving The Multiple Values Set By A Form
I am passing a form to a php script for further processing.

I am able to retrieve the last value set for that given form variable
using
$variable=$_REQUEST['form_variable'];

My question is, what is the Php way of retrieving all the values passed
for the same form variable?

For example, if the php script is called with a syntax like

http://xxxx/get_variables.php?form_...riable=variable

, how do I iterate through all the values that form_variable has been
set to?

Select List With A Loop
I want to accomplish a function that creates a select list with a loop of results from the DB, I have that, it is: PHP Code:

List Box Multiple Select
I am trying to create a drop down list that permits a person to select multiple items from the list and have the results posted on a results page. I am using Dreamerweaver MX, PHP and a MYSQL database. I was able to select multiple items but only the last selected item would be displayed. I tried to modify the list box code and now it returns nothing. Code:

Retrieving A Filename From A Filefield Form Element
I'm trying to retrieve a filename from a file i select using a fieldfield. I'm unable to upload the file to my ftp server due to stupid limitations from my server provider.  So I am uploading the file using a standard ftp client software and then selecting the file of my harddrive to associate with an entry in a database.

The problem is everytime I select a file and click on Submit, PHP seems to temporarily upload the file before retrieving the filename. So if this is a big file it can take a while when it should be a near instant process to take the path of the filename and remove everything but the filename+extension.

Is there anyway of retrieving the filename in a quicker way than the way it is doing it at the moment?

Select List/Menu Using PHP And MYSQL
Here is my code:

<select name="country" class="sidelinks">
<?php
do
{
?>
<option value="<?php echo $row_AllCountries['country_ID']." ";?>"<?php if ($row_AllCountries['country_ID'] = $acountry) { echo "selected"; }?> >
<?php echo $row_AllCountries['countryname'];?></option>
<?php
}
while ($row_AllCountries = mysql_fetch_assoc($AllCountries));
?>
</select>

A few words to describe:
-$row_AllCountries['country_ID'](get from MySQL) is a unique country ID number
-$row_AllCountries['countryname'](get from MySQL) is the name of the country
-$acountry is the country ID number that i want to be selected when the form loads

I have all the values and country names named OK...the only problem is that when the form loads it selects the last country.

Displaying A List Of Categories From A Database In A Select Box
Could someone please tell me why this outputs nothing

<select name=categories>
<?
$cat_array = get_categories();
foreach($cat_array as $this_cat)
{
echo "<option value="";
echo $this_cat["category_id"];
echo """;
echo ">";
echo $this_cat["category_name"];
echo "
";
}
?>
</select>

==========================================================

function get_categories()
{
//get the list of categories from the database

$conn = mysql_pconnect("localhost", "user", "pwd");
$query = "select * from categories";
$result = mysql_query($query);
if(!$result)
return false;

$num_cats = mysql_num_rows($result);
if($num_cats == 0)
return false;

$result = db_result_to_array($result);
return $result;
}

//A function that returns a query to the database as an array
function db_result_to_array($result)
{
$res_array = array();
for($count=0; $row=@mysql_fetch_array($result); $count++)
$res_array[$count] = $row;

return $res_array;
}

Trying To Select Names From A Drop Down List And Display Them
So, I already have the code written where I have a drop down menu with names in it. I want to be able to select multiple names from the drop down list and have them display in a table below the drop down menu. First off, I can't get one name to display, not to mention multiples. :p How may I accomplish this?

CODE:

How To Response Immediately When I Select The Drop-box List
Do you have any idea when I try to select a drop box list, the data
will show up in the following textbox immediately?

eg.

Name:
---------------
drop-box list | <- when i select one of them
---------------

Age:
---------------
Textfield 1 | <- pop up immediately
---------------

Address:
---------------
Textfield 2 |
---------------

Popup Window List Of Values To Select
What i need to do is bring up a popup window with a list of values(values looked up from the database). The user should be able to select one of the values from the list and the value then populate a text box on the calling form.

Insert Data From Multiple Select List
Am trying to insert data into a mysql database from a multiple select list. How would i do this? Code:

Select From Drop List To Fill Table Column With Text -- HOW ?
I want viewers to compare state laws on a single subject.

Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the column below.
The viewer can select states from the drop down lists above the other two
columns as well. If the viewer selects only one, only one column fills. If
the viewer selects two states, two columns fill. Etc.

I could, if appropriate, have a separate htm page with the text for each
state -- california.htm for example. When the viewer selects California from
the drop down list, the column below would "fill" with California.htm.

Or, I could conceivably use a text or mysql database with two fields for
each record: state_name and law_text -- but it would probably be easier to
use separate htm files, since there will only be about 20 states involved,
and the "database" would never have a large number of records.

The table width would be 100% and each cell would be @33%

My site is designed with FP 2002 and runs on Apache/FreeBSD. I have just had
Apache-ASP installed but I have not yet configured or used the module.

Checking Form Contents
I would like to verify the contents of a form before inserting the data into a mySQL database. How can I check the contents of the form and return the user to the form if they have not completed all the required fields(with the data they have entered intact). Only after the form is verified to contain all the mandatory data do I want to insert it into the database.

In addition, it would be great if I could highlight the fields that are missing data. Currently, I have a php script handling the submission and insertion. Is it possible to make that submission conditional?

How To Change Form Field Contents In Existing PDF Using PHP?
Simple case:

1. I have a PDF file I made with Acrobat PRO. It contains a form with
two fields, "Name" and "TestScore".

2. From my PHP file on linux server I just want to open this PDF file
and change the content of the Name and Testscore form fields.

Could someone show me a simple code example on this?

And what do I need of addons? PDFlib and licences?

Session Variables Resets The Contents Of A Form
i have a form in a page that has a header with a session variable the problem is that if i fill the form and submit the form to another page, now if i want to go back to the form using the back button of the browser the contents of the form will be reset!!! please tell me what to do if this is a common problem or i can get rid of this problem cause it's annoying to fill the form again. PHP Code:

Security Issues With Posting Form Contents To Server?
I'm currently reading a php book that attempts to declare the security hazzards of not screening a form's content before allowing it to be posted, whether to a database, text file, or otherwise. Honestly, I still don't get what the problem is.

Lets say magic quotes is turned on. Could someone list the major things I should still be doing to prevent security problems? For example, the book says to use htmlspecialchars(), though how does allowing the user to enter HTML tags compromise anything? The data simply gets posted as is to a database, then output as is Maybe an annoying JavaScript is output, but hardly a security breach to the server itself as far as I can tell.

Formatting The Contents Of A Text Area Form Field
On my site I get users to enter a load of information in a textarea
box, however when i save this data to my mysql DB and then retrieve it,
it comes out without all the formatting, like new paragraphs and new
lines.

Can anyone tell me how you can capture the data entered into such a
field with all the formatting the user has entered like new paragraphs
etc?

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.

FORM SUBMIT
Can I pass data from one form to another on one page (what i've got is one form that when the submit button is pressed it submits the form in another window, part of my form:
PHP Code:

Php Submit Form
what I am trying to do is make form so I can put my password in and then it sends it to my email from wherever I am. This what I have so far. For some reason I cant make it work Code:

Submit Form
I have this code and when i put the amount of tickets you buy and hit Return it does not submit and there is no change to the database, yet when you hit the submit button it works. Code:

PHP Form Submit
I'm really new to PHP but I need a form submit on my website. When using the form everything seems to work, but I am not receiving the data from my form. I used a program that I found to make the form and was hoping that it would just work.

Form Variables Without Submit
Is there a way to pass variables from a form to PHP without submitting the form? ie. retrieving a user's selection from a picklist or checkbox.

Form Submit Question
I have a script that may/may not have a URL parameter called
month, i.e. http://www.myhost.com/myscript.php?month=5

I have a form on the page that has a dropdown named team.
I want to re-submit this page with the value from the dropdown
when the user presses a button named Go. This value needs
to be appended to the URL in the fashion:
http://www.myhost.com/myscript.php?month=4&team=22

Looks like I may need some javascript in this as well, huh?

Remote Form Submit
say for example, theres a url given to me, on that page theres a form, with a text box and a submit button. if i know names of both, can i fill it in and submit remotely, and say retrieving results of the next coming page? i know how to store a url in a file, but i just dont know how to do the above.

Submit Form By Script
I was wondering if it was possible to have a form submitted automatically without the need for a submit button. I thought this might be a way to send arrays to another script.

Is there another way to pass an array to another script, i tried via GET but it sends the word "array" and not its actual contents like so.

s.php
-------------
<?php
$error[] = "Enter Name";
$error[] = "Enter Password";
header("Location: a.php?error=$error");
?>

a.php
-------------
<?php
$error = $_GET['error'];
echo $error . "<br>";
?>

Submit Form Once Per IP Address Per Day
I am looking for a PHP script form which will send the form only once per IP address in 24 hours!

Return Shall Not Submit A Form
I have the problem that I want to submit a form only if the submit button is
clicked with the mouse. The form should not be submitted if the user hits the RETURN key.

Submit Form By Pressing Any Key.
I would like to create a hidden form which shold be submitted after
user press any key. Is it possible?

Form Submit Button
Should be a quickie but I just can't get it to work.

I have a form where my users can submit their football picks, when they
click submit I would like another sized window to appear (mnf_scores.htm)
where they can submit a total score for the Monday night football game each
week. From the research I've done I think I need the following:

// If this is change picks, output the submit button and close the form
if ($userfunc==1) {
echo "<p><input type="submit" value="Submit Your Picks!"
onclick="window.open('mnf_scores.htm','MNF Scores')"/></p>
</form>
";
}

But that just doesn't seem to work. The submit part works but the subsequent
window is not opened.

Automatic Form Submit
I have to develop an application sounds like this:-
User is allow to access a form (is actually a test/quiz) within a
specific time frame, let say 45 minutes. After this 45 minutes, if the
user has not yet click the submit button to submit the form, the
system need to automatically submit it.

So, can anyone teach me how to check the time out as well as how to
make the form submit automatically? Thank you very much.

Source Of Form Submit
What is the best way to detect the URL where the form has been submitted, here’s an example "www.domain.com/page1.php" has a form that will be submitted to "www.domain.com/page2.php". I need to be sure that all variables that will be submitted to page2.php are from page1.php of the same domain or else I have to deny the request.

Tracking A Form Submit
I'm tracking how often a form is submitted, so I can count how many items are send. In the results page after submitting the form I add 1 to a table in MySQL. The problem is that when you reload the page the table is updated again. How can I solve this so I only count it one time?

Auto Submit A Form In PHP
Does anybody know how to auto-submit a form in PHP without Javascript?

For instance, submit form variables to self, validate the data in PHP on
same page, then, if no errors, auto-submit the data via post rather than
URL. Could serialize a few fields to URL, but there is a larger comments
field that I think needs to be posted instead.

Auto-post the form variables possible?




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