MrSean Posted February 9, 2011 Share Posted February 9, 2011 Hello there I'm new and quite stuck. So here we go! I have the following HTML form. <form method="post" action="/Install/Step02/"> Server: <input type="text" name="MySQL[server]" /><br /> Database: <input type="text" name="MySQL[Databaser]" /><br /> </form> Now to my understanding I should receive something along the lines of $_POST['MySQL']=>array();. But instead I get an empty string. Why is this? Link to comment https://forums.phpfreaks.com/topic/227214-multidimensional-arrays-via-post/ Share on other sites More sharing options...
MadTechie Posted February 9, 2011 Share Posted February 9, 2011 sounds correct this is the basic idea <form method="post" action=""> Server: <input type="text" name="MySQL[server]" /><br /> Database: <input type="text" name="MySQL[Databaser]" /><br /> <input type="submit" name="send" value="send" /><br /> </form> <?php echo $_POST['MySQL']['Server']; echo $_POST['MySQL']['Databaser']; Link to comment https://forums.phpfreaks.com/topic/227214-multidimensional-arrays-via-post/#findComment-1172038 Share on other sites More sharing options...
MrSean Posted February 9, 2011 Author Share Posted February 9, 2011 Wait I managed to figure it out. Because I'm paranoid I have allot of things going through $_POST = array_map("mysql_real_escape_string", $_POST);. I'll have to look into a work around. that or remove that piece of code. Link to comment https://forums.phpfreaks.com/topic/227214-multidimensional-arrays-via-post/#findComment-1172042 Share on other sites More sharing options...
MadTechie Posted February 9, 2011 Share Posted February 9, 2011 Well that code isn't secure either, personally I escape per query however if your happy with it you can simply update to this function recursive_escape(&$value) { if (is_array($value)){ array_map('recursive_escape', $value); }else{ $value = mysql_real_escape_string($value); } } array_map('recursive_escape', $_POST); Link to comment https://forums.phpfreaks.com/topic/227214-multidimensional-arrays-via-post/#findComment-1172069 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.