Jump to content

Foreach($_post As $key=>$value) Details


Recommended Posts

I have fields for start time in form to submit data via email as:

  <p class="label"><label for="evt_hour">FROM:</label>     <select name="evt_hour" id="evt_hour">     <option value="0">00</option><?php    for ($i = 1; $i < 24; $i++)    {        printf('<option value="%d">%02d</option>', $i, $i);    }?>    </select> : <select name="evt_min"><?php    for ($i = 0; $i < 59; $i += 30)    {            printf('<option value="%d">%02d</option>', $i, $i);    }?>    </select>   </p>

I gather the $_POST data to be sent as:

foreach($_POST as $key=>$value)		{  			$S.= $key .": ". $value."\n";			}

The email will have those fields for example as:evt_hour: 12evt_min: 30How can I do it that it sends it as:Start time: 12:30?There are 5 other fields which do not need to be joined and are totally ok the way they are...Son

Link to comment
Share on other sites

Instead of using a foreach loop to loop through everything in $_POST you need to do it individually so you can format everything how you want. Or, you can modify what's in $_POST before you loop through it.
Many thanks. Will have a go...Son
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...