PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 27th, 2000, 10:39 PM
dalida dalida is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 dalida User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Hi,

I try to print the results from the checkbox but I don't know the code. Can you help? Thanks!
This is my test project!
<form action="test.php3" method="POST">
<input type=="text" name="name" MAXLENGTH="60" SIZE="20">
<input type="checkbox" name="checks[]" value="item1">item1
<input type="checkbox" name="checks[]" value="item2">item2
<input type="checkbox" name="checks[]" value="item3">item3<br>
<input type="checkbox" name="checks[]" value="item4">item4
<input type="checkbox" name="checks[]" value="item5">item5
<input type="checkbox" name="checks[]" value="item">item6
<P><input type="Submit" value="Submit">
---------------------------
My test.php3
<?
Thank you $name;
Your selection is: ????
?>

[This message has been edited by dalida (edited April 27, 2000).]

Reply With Quote
  #2  
Old April 28th, 2000, 12:04 AM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
<?
$values=$HTTP_POST_VARS[checks];

if(count($values)>0))
{
print"Thank you $name<br>";
print"Your selection is ";
print"<UL>";
for($i=0; $i<count($values); $i++)
print"<li>$values[$i]</li>";
print"</UL>";
}

else
print"You picked absolutely nothing!";
}

// format to taste

Hip Hip Array

Kyuzo

Reply With Quote
  #3  
Old April 28th, 2000, 12:33 AM
dalida dalida is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 dalida User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Kyuzo:
<?
$values=$HTTP_POST_VARS[checks];

if(count($values)>0))
{
print"Thank you $name<br>";
print"Your selection is ";
print"<UL>";
for($i=0; $i<count($values); $i++)
print"<li>$values[$i]</li>";
print"</UL>";
}

else
print"You picked absolutely nothing!";
}

// format to taste

Hip Hip Array

Kyuzo
[/quote]

-------
Hello Kyuzo,
I get a parse error on line 5
Thanks !

Reply With Quote
  #4  
Old April 28th, 2000, 03:58 AM
weddeh weddeh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 7 weddeh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to weddeh
<form action="test-response.php" method="POST">
<input type=="text" name="name" MAXLENGTH="60" SIZE="20">
<br><input type="checkbox" name="checks[]" value="item1">item One
<br><input type="checkbox" name="checks[]" value="item2">item Two
<br><input type="checkbox" name="checks[]" value="item3">item Three
<br><input type="checkbox" name="checks[]" value="item4">item Four
<br><input type="checkbox" name="checks[]" value="item5">item Five
<br><input type="checkbox" name="checks[]" value="item6">item Six
<P><input type="Submit" value="Submit">
</form>


test-response.php
<?
echo "Thank you $name<br>";
if (sizeof($name) > 0) {
echo "<br>Your selection is: ".implode(",",$checks);
}
?>

------------------
Cheers,
Tata

Reply With Quote
  #5  
Old April 28th, 2000, 12:21 PM
dalida dalida is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 dalida User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by weddeh:
<form action="test-response.php" method="POST">
<input type=="text" name="name" MAXLENGTH="60" SIZE="20">
<br><input type="checkbox" name="checks[]" value="item1">item One
<br><input type="checkbox" name="checks[]" value="item2">item Two
<br><input type="checkbox" name="checks[]" value="item3">item Three
<br><input type="checkbox" name="checks[]" value="item4">item Four
<br><input type="checkbox" name="checks[]" value="item5">item Five
<br><input type="checkbox" name="checks[]" value="item6">item Six
<P><input type="Submit" value="Submit">
</form>


test-response.php
<?
echo "Thank you $name<br>";
if (sizeof($name) > 0) {
echo "<br>Your selection is: ".implode(",",$checks);
}
?>
[/quote]

Cool! it work fine... thanks a lot for your help.

Regards!
Dalida

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > print checkbox results!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap