Jump to content

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


son

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...