Help to convert a string variable to an integer one!
Posted: Wed Jul 28, 2004 7:13 am
I have this code at the beggining of my script. The problem is that i want to use $prints as an integer not as a string variable.
If i have entered $number_of_rows it comes from a html form:
The script produces IT IS AN INTEGER100 if i run my page at first time but it becomes IT IS STRING20 if choose 20 from the menu!
Any ideas to make the convertion back to integer ???
Code: Select all
<?php
if(isset($number_of_rows))
{
$prints=$number_of_rows;
}
else
{
$prints=100;
}
if (is_int($prints)){
echo' IT IS AN INTEGER';
}
if(is_string($prints)){
echo' IT IS A STRING';
echo $prints;
}
?>Code: Select all
<form name="select_number_of_rows" method="post" action="view_customer_info_grid.php?step='.$cstep.'">
<input name="cstep" type="hidden" class="style2" id="go" value="'.$step.'">
<span class="style2">Number of results on each page:</span> <select name="number_of_rows" class="style2" id="number_of_rows">
<option selected>100</option>
<option>50</option>
<option>20</option>
<option>10</option>
</select>
<input name="go" type="submit" class="style2" id="go" value="Go">
</form>Any ideas to make the convertion back to integer ???