Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/143ebd2cccbe1661cb1573402ee08ee1 to your computer and use it in GitHub Desktop.
Save trycf/143ebd2cccbe1661cb1573402ee08ee1 to your computer and use it in GitHub Desktop.
TryCF Gist
<!-- Input Form -->
<form action="processNumber.cfm" method="post">
Enter the number: <input type="text" name="num">
<input type="submit" value="Submit">
</form>
<!-- Processing the Input -->
<!--<cfif CGI.REQUEST_METHOD EQ 'POST'></cfif>-->
<cfif StructKeyExists(form, "num") AND Len(form.num) GT 0>
<cfset num = Val(form.num)> <!-- Convert input to numeric -->
<cfif num GT 0>
<cfoutput>#num# is positive</cfoutput>
<cfelseif num LT 0>
<cfoutput>#num# is negative</cfoutput>
<cfelse>
<cfoutput>#num# is zero</cfoutput>
</cfif>
<cfelse>
<cfoutput>Please enter a number above.</cfoutput>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment