Hello there,
I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this.
The code i used is in page 1 is: -
<td align="left">
-
<select multiple name='srtestrun[]' style='width:300px;' size='10' >
-
-
<?php
-
-
if($srproject != 0 && $srproject > 0)
-
{ $sql = "SELECT TR.TEST_RUNID, TR.TEST_RUN_NAME
-
FROM TEST_RUN TR, PROJECT_RUN PR
-
WHERE TR.TEST_RUNID = PR.TEST_RUNID
-
AND PR.PROJECTID = ".$srproject."
-
ORDER BY TR.TEST_RUN_NAME";
-
$smc->query($sql) or die("<h4>Error in <br><br>".$sql."</h4>");
-
$TR=$smc->result;
-
for($i=0; $i < sizeof($TR); $i++)
-
{ echo "<option value=\"".$TR[$i][0]."\">".$TR[$i][1]."</option>";
-
}
-
}
-
-
?>
-
</select>
-
</td>
-
The code in page 2 to retrieve these values is: -
$srtestrun = $_POST['srtestrun'];
-
for ($i = 0; $i < sizeof($srtestrun); $i++) {
-
echo $srtestrun[$i];
-
}
-
But i am not able to get anything.If i am trying without using "$_POST" i am able to retrieve the last value i selected in the select box.
Thanks in Advance,
Shara.
3 4801
Hello there,
I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this.
The code i used is in page 1 is: -
<td align="left">
-
<select multiple name='srtestrun[]' style='width:300px;' size='10' >
-
-
<?php
-
-
if($srproject != 0 && $srproject > 0)
-
{ $sql = "SELECT TR.TEST_RUNID, TR.TEST_RUN_NAME
-
FROM TEST_RUN TR, PROJECT_RUN PR
-
WHERE TR.TEST_RUNID = PR.TEST_RUNID
-
AND PR.PROJECTID = ".$srproject."
-
ORDER BY TR.TEST_RUN_NAME";
-
$smc->query($sql) or die("<h4>Error in <br><br>".$sql."</h4>");
-
$TR=$smc->result;
-
for($i=0; $i < sizeof($TR); $i++)
-
{ echo "<option value=\"".$TR[$i][0]."\">".$TR[$i][1]."</option>";
-
}
-
}
-
-
?>
-
</select>
-
</td>
-
The code in page 2 to retrieve these values is: -
$srtestrun = $_POST['srtestrun'];
-
for ($i = 0; $i < sizeof($srtestrun); $i++) {
-
echo $srtestrun[$i];
-
}
-
But i am not able to get anything.If i am trying without using "$_POST" i am able to retrieve the last value i selected in the select box.
Thanks in Advance,
Shara.
Hi,
You can do it this way, Once all the stuff is selected from the select box, you can use the implode function to fetch it into a variable. You can use comma as the delimiter.
Lets say you have a submit button that you use to submit your form, then the code in the second page could be like this, -
<?php
-
$var = implode(",","srtestrun");
-
?>
there you have all the variables, Now to display them, -
<?php
-
$var_display = explode(",",$var);
-
?>
[Please use CODE tags when posting source code. Thanks! --pbmods]
Hope this helps you.
Regards
CyberKing
I do it this way: -
$option = $_POST['frm_company_address_book_cbo'];
-
foreach ($option as $selected)
-
etc.
-
etc.
[Please use CODE tags when posting source code. Thanks! --pbmods] pbmods 5,821
Recognized Expert Expert Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kevin Lyons |
last post by:
Hello,
I am trying to get my select options (courses) passed correctly from
the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html
I am having difficulty getting the courses to pass the correct option
value and then be displayed at the following URL:
http://www.dslextreme.com/users/kevinlyons/selectResults.html
I am passing countries, products, and courses. The first two display
|
by: Richard |
last post by:
**** Post for FREE via your newsreader at post.usenet.com ****
HI,
I am working on a project where I need to input data to a (local) HTML page
using multiple form elements, such as text, radio, checkbox, and dropdown.
When the form Submit button is clicked, I then need the input data either
written to another location on the same page, or written to another page (a
different frame would be fine)
|
by: Drew |
last post by:
I have a db table like the following,
UID, int auto-increment
RegNo
Person
Relation
YearsKnown
Now here is some sample data from this table,
|
by: Anne |
last post by:
hie there, i want to be able to pass multiple parameters
to another page. currently, i am able to do so, but
somehow i feel it is not the correct way to do it. below
is part of what i have so far.
'first page
Private Sub btnOK_ServerClick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnOK.Click
Response.Redirect("InputValues.aspx?Requestor=" &
|
by: Eric |
last post by:
Hello,
I am trying to come up with the best way to pass large amounts of data from
page to page, namely a data table.
The user needs to enter data into a form in one page and confirm it on
another. Session variables seem like the easiest, but I'm afraid of
crashing the server after deploying with a few hundred users as opposed to
just a few developers/testers. Any ideas?
| |
by: macyp |
last post by:
I have to pass values from one aspx page to another. The controls I
have in the first page are:
a textbox, 3 drop down lists, and 2 check boxes, and a submit button.
It is a search page, and the users need not enter values in all the
controls. they can leave the textbox blank, and select values from one
drop down, or any other combinations.
I am trying to pass values with the help of session variables. But I
have multiple if else...
|
by: chariclark |
last post by:
This may be a quick fix post...
----------------------------
I am having trouble passing multiple values into stored procedure. Here it is below:
CREATE Procedure spGetAssociateds
(
@PDSI int
)
AS
|
by: Max |
last post by:
Is there any way to set a select-multiple type <select
multiple="multiple"with multiple selected options in scripting?
Any idea about this is appreciative.
|
by: =?Utf-8?B?UGF1bA==?= |
last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of
"Multiple". The user can select multiple dates from the listbox.
I have ObjectDataSource named "ods_rfq" with a ControlParameter that has a
ControlID that points to "lb_dates". The PropertyName of the ControlParameter
is "SelectedValue".
The user selects two dates from the ListBox.
I am trying to pass BOTH selected values of the ListBox to a SelectMethod of
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |