acctman Posted October 16, 2008 Share Posted October 16, 2008 in my FORM I have the names setup to be retrieved with an array in php in php I use the following code to Update the database foreach ($_POST['add'] as $col => $value) $_POST['add'][$col] = strip_tags(stripslashes($value)); { mysql_query("UPDATE rate_members SET m_".$col."='".sql_escape_string(stripslashes($value))."' WHERE m_id='$m_id'"); } my problem is how do I retrieve a single $_Post name and value from the FORM? I know how to do it when and array grabbing all, but what about just one item? example code is that I'm trying to run but its not working since the name values are name=add[city] name=add[state] name=add[country] etc in the FORM. if ($_POST['city'] == "" || $_POST['orientation'] == "" || $_POST['status'] == "" || $_POST['ethnicity'] == ""){ $err; } Link to comment https://forums.phpfreaks.com/topic/128744-solved-minor-problem-retrieving-form-array-names-in-php/ Share on other sites More sharing options...
Barand Posted October 16, 2008 Share Posted October 16, 2008 echo $_POST['add']['city'] should give the city name. Is that what you mean? Link to comment https://forums.phpfreaks.com/topic/128744-solved-minor-problem-retrieving-form-array-names-in-php/#findComment-667333 Share on other sites More sharing options...
acctman Posted October 16, 2008 Author Share Posted October 16, 2008 thanks ['add'] was what i was missing Link to comment https://forums.phpfreaks.com/topic/128744-solved-minor-problem-retrieving-form-array-names-in-php/#findComment-667393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.