Perl cgi string to float number -


this have in html file

<form action="drinks.cgi" method="post" target="re"> ... quantity:<input name="quan" type="number" step="any"> (ml) <input style="margin-left:20px" type="submit" value="submit"/> ... ... </form> 

and in cgi file

my $quan = $conn->quote($cgi->param(quan)); printf $quan; 

let's type 222 in input

i expected printed out 222 printed out '222' instead... how can rid of 2 ' in cgi file can use variable other calculations.

if calculations done in perl, use

my $quan = $cgi->param('quan'); 

if calculations done in sql, start above , follow with

die if $quan !~ /^[0-9]+\z/; $quan_sqllit = $quan; 

or

# quotes aren't problem. $quan_sqllit = $conn->quote($quan); 

or

my $quan_sqllit = "cast(".$conn->quote($quan)." int)"; 

or

# maybe. depends on implementation of $conn->quote. $quan_sqllit = $conn->quote(0+$quan); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -