Re: Str to Int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



well I don't well understand the problem hope these two snippets can solve
your problem: i tested them seems fine

file 1 form.php

<html>

<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>enter tour code</title>
</head>

<body>

<p>&nbsp;</p>
<p>enter tour code</p>
<form method="POST" action="get_card.php">
 <table border="1" width="47%" id="table1">
  <tr>
   <td width="186">user</td>
   <td><input type="text" name="txt_user" size="20"></td>
  </tr>
  <tr>
   <td width="186">code</td>
   <td><input type="text" name="txt_id" size="20"></td>
  </tr>
  <tr>
   <td colspan="2">
   <p align="center"><input type="submit" value="Invia" name="B1">
   <input type="reset" value="Reimposta" name="B2"></td>
  </tr>
 </table>
 <p dir="ltr">&nbsp;</p>
</form>
<p>&nbsp;</p>

</body>

</html>



file 2
------

get_card.php

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova pagina 1</title>
</head>

<body>

<?php

print "string value:::".$_POST['txt_id']."<br>";

$int_id=intval(trim($_POST['txt_id']));

print "integer value:::$int_id"."<br>";

print "type returned:".gettype($int_id)."<br>";

?>


</body>

</html>











2006/1/20, Ron Eggler (Paykiosks) <ron@xxxxxxxxxxxxx>:
>
> Hi,
>
> I need to do a type cast from string to int in folllowing code:
> [php]
> <getPIN cardID="'.intval(trim($cardID)).'" quantity="1" />
> [/php]
> I need $cardID have converted to int. I thought it should work that way
> but it does not!
> But it's working if I'm putting
> [php]
> <getPIN cardID="180" quantity="1" />
> [/php]
> in there. I got card ID as a var that is passed as get like:
> [php]
> $cardID = $HTTP_GET_VARS[cardID];
> [/php]
>
> Can anyone help me in that issue? Thank you!
>
> __________________________________________
>
> Ron Eggler
> Intern
> 866-999-4179
> www.paykiosks.net
>
>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux