You are here: Re: Getting list of checkboxes and value in next page « PHP Programming Language « IT news, forums, messages
Re: Getting list of checkboxes and value in next page

Posted by Jerry Stuckle on 08/06/07 13:10

jeet wrote:
> Plz help me.Problem is that On the first page I display all other user
> with checkbox and give user option to select only two user which he
> wants to send message. Tell me please how I'll get those checkboxes
> value and name on the next page and send message to only those two
> selected user.
> Thanx in
> advance
>

It's not too hard. In our first page, have something like:

<form name="form1" method="post" action="/page2.php">
<input type="checkbox" name="user[]" value="1">
<input type="checkbox" name="user[]" value="2">
<input type="checkbox" name="user[]" value="3">
<input type="checkbox" name="user[]" value="4">
</form>

In your second page, $_POST['user'] contain the data:

if (isset($_POST['user'])) {
if (count($_POST['user'])) > 2) :
echo "Too many users selected!";
}
else {
foreach ($_POST['user'] as $user) {
// validate and handle the data here
}
}
}
else {
echo "No users selected";
}




--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация