Copy link to clipboard
Copied
Guys,
I have the script PHP below.
How I write this script in ColdFusion, sorry for the dummie's ask
<?php
if(isset($_POST[“color”])) {
for($i = 0; $i < count($_POST[“color”]); $i++) {
echo “The color “.$_POST[“color”][$i].” was selected!<br />”;
}
} else {
echo “blablablablablablablabla”
}
?>
[ ]'s
Copy link to clipboard
Copied
I assume on the form, colour is a series of checkboxes.
if (StructKeyExists(form, "color") {
for (i = 1; i lte ListLen(form.color); i++)
writeoutput("The color #ListGetAt(form.color, i)# was selected<br>") ;
}
else {
}
Copy link to clipboard
Copied
Hi Dan,
Tks for your answer, my doubt is. Where putting this code, inside a tag <cfscript> or a <cfif>.
You Could, show me a example?
Thanks one more time.
[ ]'s
Fabiano Magno Pechibella
Copy link to clipboard
Copied
The code I wrote would go inside a set of <cfscript> tags. The tag based version would be:
<cfif StructKeyExists(form, "color")>
<cfoutput>
<cfloop list = "#form.color#" index = "ThisColor">
The color #ThisColor# was selected.<br>
</cfloop>
<cfoutput>
<cfelse>
code for no boxes checked.
</cfif>
Copy link to clipboard
Copied
Great Dan,
You are the best.
Hug's from Brazil.
Fabiano Magno Pechibella