zartzar Posted February 18, 2009 Share Posted February 18, 2009 Hi i need to have a few values that i submitted in a form turned in to strings. My form handler is a seperate php file. How do i turn those values into strings? Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/ Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 Depending on how the form is processed either $forminputname = $_GET['forminputname']; // OR $form2inputname = $_POST['form2inputname']; Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/#findComment-765524 Share on other sites More sharing options...
Maq Posted February 18, 2009 Share Posted February 18, 2009 If you're referring to casting the variables to strings, you don't have to. PHP is a very loosely typed language, can I ask what your reason is for this? Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/#findComment-765530 Share on other sites More sharing options...
zartzar Posted February 18, 2009 Author Share Posted February 18, 2009 Depending on how the form is processed either $forminputname = $_GET['forminputname']; // OR $form2inputname = $_POST['form2inputname']; D'oh! Thats so obvious :palmface:. Still i cant get it to work. Whats wrong with my code?: print "<tr> <td>Race Distance:</td> <td> {$_POST['distance']} </td> </tr>"; print "<tr> <td>Race Time:</td> <td> {$_POST['H']} Hours, {$_POST['M']} Min </td> </tr>"; print "<tr> <td>Your average speed should be:</td> <td> $average </td> </tr>"; $H=$_POST['H']; $M=$_POST['M']; $distance=$_POST['distance']; $average=$H+($M/60)/$distance; it just prints nothing for $average ? Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/#findComment-765544 Share on other sites More sharing options...
zartzar Posted February 18, 2009 Author Share Posted February 18, 2009 Oh! I should declare the variables before printing everything Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/#findComment-765546 Share on other sites More sharing options...
premiso Posted February 18, 2009 Share Posted February 18, 2009 Oh! I should declare the variables before printing everything That tends to help. Quote Link to comment https://forums.phpfreaks.com/topic/145805-how-to-turn-form-data-into-strings/#findComment-765552 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.