php - Trying to pull responses from a form -


so trying pull of responses when click button in order show placed. using following line inside of method in php attempted pull , relay information. of such not working me.

php method

function results(){     $responses = $_post['test'];     foreach($responses $response){       print "".$response." <br />";     } } 

form tag

<form id="test" name="test"> 

button

  <button type="button" onclick="results()">     complete   </button> 

your post keys bind parameters within form, not form

html

<form id="test" name="test">     <input type="text" name="somfield" />     <button type="button" onclick="results()"> complete </button> </form> 

would access

php

function results(){     $response = $_post['somefield']; } 

so loop keys of post

foreach($_post $name => $value) {     print "$name : $value<br>"; } 

that should it.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -