doubledee Posted March 31, 2011 Share Posted March 31, 2011 When you submit an HTML form using POST, what are the $key->$value pairs?? Debbie Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/ Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 That depends on the input type used, but this page covers some common cases: http://www.php.net/manual/en/language.variables.external.php Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/#findComment-1194782 Share on other sites More sharing options...
doubledee Posted March 31, 2011 Author Share Posted March 31, 2011 That depends on the input type used, but this page covers some common cases: http://www.php.net/manual/en/language.variables.external.php In the example I gave, doesn't the $key get the input's name and the $value gets what the user submitted? Debbie Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/#findComment-1194786 Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 Yes, the key is the input name and the value is what the user entered or selected. There's also special rules for multi-valued inputs, with an example on the page I linked for "beer[]". Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/#findComment-1194797 Share on other sites More sharing options...
doubledee Posted March 31, 2011 Author Share Posted March 31, 2011 Yes, the key is the input name and the value is what the user entered or selected. There's also special rules for multi-valued inputs, with an example on the page I linked for "beer[]". Sorry, it is really late here! If I have this... <select name="expMonth"> <option></option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> </select> ...for the Credit Card Expiration Month, and the user selects "08" for August, how would I capture that value? Debbie Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/#findComment-1194799 Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 I think you will find the value in $_POST['expMonth']. I'm not 100% sure because I don't use HTML much, although I use a lot of PHP. Link to comment https://forums.phpfreaks.com/topic/232250-question-about-post/#findComment-1194875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.