I have a php script that looks like this:
$contacts["{$firstname}"] = $_POST["{$firstname}"] ;
$contacts["{$lastname}"] = $_POST["{$lastname}"] ;
$contacts["{$age}"] = $_POST["{$age}"] ;
$collection->insert($contacts);
so this works fine but i all of these values are going into my collection as "fistname", "lastname" and "age" with quotes around all. I want the quotes around first name and last name but i want the age field to insert as a number/integer not a quoted string. How do I make sure that the age field and other numeric fields go into the mongodb/collection as a number?
I was thinking something like: integer -> $_POST["{$age}"] but im sure that's not right. Again im using PHP not the shell. Thnaks.
Thank you for your help.
$firstnamestores is available in $_POST? Use php.net/manual/en/function.isset.php to check.