473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Having Problems in passing the checkbox value to next page

Hi,
I am really having problem in checkbox....
i have a php page which displays the username retrieved from the database i want to create a checkbox for each username and pass the selected multiple checkbox value to another page after selecting any one of the option value from the select box and after clicking on "go" button.

In option value i have links to go for particular page.


Plz help me out........
Its very urgent......
Oct 20 '07 #1
11 8585
pbmods
5,821 Expert 4TB
Heya, manjunath1985. Welcome to TSDN!

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Oct 20 '07 #2
Heya, manjunath1985. Welcome to TSDN!

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
here is the code
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="candidateusername" value="select[]">
i want to put a checkbox for candidateusername retrieved from the database and pass the multiple username selected checkbox value to next page after i select
<option value="send_sms.php"> and after pressing "go" button.
but i am not able to view the checkbox value in the selected page.
Oct 22 '07 #3
hi,
i am having some serious problem with checkbox....

here is the code
<input type="checkbox" name="candidateusername" value="select[]">
i want to put a checkbox for candidateusername retrieved from the database and pass the multiple username selected checkbox value to next page after i select
<option value="send_sms.php"> and after pressing "go" button.
but i am not able to view the checkbox value in the selected page.

Plz help me out....
Its very urgent...
Oct 22 '07 #4
and pass the multiple username selected checkbox value to next page after i select.
Can you rephrase that so that it's more clear?
Oct 22 '07 #5
Can you rephrase that so that it's more clear?
I have retrieved some usernames as per the code in one page. but i want to put a checkbox for all usernames and pass the same to the next page through the <option value="send_smd.php"> and after clicking on "go" button.
Oct 22 '07 #6
Oh, well you're totally confused. Try starting with this code:
[html]
<form method="post" action="send_sms.php">
<input type="checkbox" name="candidateusername[]" value="dude's name"> Dude's Name<br />
<input type="checkbox" name="candidateusername[]" value="dudette's name"> Dudette's Name<br />
... repeat as much as you want
<input type="submit" value="Go" />
</form>
[/html]

Then, in send_sms.php, you can do something like this:

[php]
<?php
foreach ($_POST['candidateusername'] as $a_candidate) {
//Do something for the candidate whose name is in $a_candidate.
}
?>
[/php]

Because of how checkboxes work, only those which are checked will be in the array.

Oh, and I have no idea what you're trying with the <option> tag, but it looks wrong.
Oct 22 '07 #7
Oh, well you're totally confused. Try starting with this code:
[html]
<form method="post" action="send_sms.php">
<input type="checkbox" name="candidateusername[]" value="dude's name"> Dude's Name<br />
<input type="checkbox" name="candidateusername[]" value="dudette's name"> Dudette's Name<br />
... repeat as much as you want
<input type="submit" value="Go" />
</form>
[/html]

Then, in send_sms.php, you can do something like this:

[php]
<?php
foreach ($_POST['candidateusername'] as $a_candidate) {
//Do something for the candidate whose name is in $a_candidate.
}
?>
[/php]

Because of how checkboxes work, only those which are checked will be in the array.

Oh, and I have no idea what you're trying with the <option> tag, but it looks wrong.
Hey i wil make it clear now, see i have a php page called viewdb.php, this page displays a usernames retrieved from the database so i want to put a checkbox for each of the username in viewdb.php and pass the selected check box value to another page called send_sms.php......

Plz help me out with the code......
Thank you for replying to my thread.....
Oct 22 '07 #8
pbmods
5,821 Expert 4TB
Heya, manjunath.

Checkboxes only appear in the submitted form when they are checked.
Oct 22 '07 #9
pbmods
5,821 Expert 4TB
Merged duplicate threads.
Oct 22 '07 #10
Hi,
I have created php page called sms.php which displays the username retrieved from the database through selecting checkbox.
Here is the code in sms.php:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. foreach($_POST['check'] as $value) //here 'check' is the name of checkbox//
  3. {                                                  //<input type =checkbox name=check[]
  4.                                                                //value=<?$row['username']?>>//
  5. $check_msg=$value;
  6.  echo "message sent to $check_msg";
  7. }
  8. ?>
  9.  
this code displays the username selected from the previous page.
But i want to pass these variables to another page called demo.php from sms.php page and display the same.
Nov 3 '07 #11
Atli
5,058 Expert 4TB
Hi.

You could use Sessions to do that.
Nov 3 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Renie83 | last post by:
What I have are two pages. One is a form with some input boxes and check boxes on it. It is posting to a different script page that inserts into a database and sends the fields through email. My...
4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
1
by: | last post by:
Hi, 1st, I did a search and could not find any info on this, the Google results were good, but I'm still have issues...So any help will be great. I have a frame page, which contains 3 frames...
1
by: Marty Meyers | last post by:
TIA for your help! I have a page (code snip below) named "browse" which has a table in it with rows like this: 2003 1500 Silverado pickup red 51,024 $19,995 Details --------- each row...
4
by: Kevin Davis | last post by:
Hello, I have the following problem with the checkbox. The issue seems to be that when I click on the following checkbox: <input type= checkbox id="checkbox1" name="<%response.Write "recount"...
3
by: delram | last post by:
I'm trying to get user selections (using checkboxes) on one JSP page(A.jsp) and pass them on to another page. So I have one page with a list of dynamically populated items like this 1 2 ...
4
by: softwaregeek | last post by:
hi to all, I am having some problem in passing parameter..... My code looks like::: request.setAttribute("game",game);...
11
by: simon2x1 | last post by:
i have 3 pages,home.php, next.php page and other.php.in the home.php page i selected name from the database and i gave it a limit and also an if statement to echo next.for the next.php page and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.