mohitgodiya Posted April 30, 2012 Share Posted April 30, 2012 hey der.... m a newbie to php and i dont know if this is the right place for this post. i have a php code and i would like it to be displayed on the browser as well as store it in mysql server in i proper format.... i tried to work with cookies but got the data displayed in array format please help me store it and display it separately i.e., name="XXXX" age="YY".........and so on the code i used in cookies is as follows <?php setcookie("name", $_POST["name"], time()+3600, "/","", 0); setcookie("age", $_POST["age"], time()+3600, "/", "", 0); ?> when i retrieve the cookie data by <?php print_r($_COOKIE)?> i get the output as: Array ( [name] => mohit [age] => 22 ) last but not the least to put the value of the cookie in mysql any help appreciated.... thnx Quote Link to comment https://forums.phpfreaks.com/topic/261829-display-php-data-and-store-it-in-my-sql/ Share on other sites More sharing options...
pwntastic Posted April 30, 2012 Share Posted April 30, 2012 Hello, if you want to just display it seperately you can do something like: <?php $name = $_COOKIE['name']; $age = $_COOKIE['age']; //if you echo $name or $age it should display(according to the info in your description) name: mohit and age: 22 ?> Quote Link to comment https://forums.phpfreaks.com/topic/261829-display-php-data-and-store-it-in-my-sql/#findComment-1341631 Share on other sites More sharing options...
Zephni Posted April 30, 2012 Share Posted April 30, 2012 Following on from pwntastic, you could then put it into a database using mysql_query <?php $query = mysql_query("INSERT INTO tablename SET name='$name', age='$age'"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/261829-display-php-data-and-store-it-in-my-sql/#findComment-1341663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.