Don. Posted November 5, 2006 Share Posted November 5, 2006 Im trying to create a time picker function with two <select></select> statements, one for the hours and one for the minutes.How do I go about retrieving and combining the results of them?Thanks. Link to comment https://forums.phpfreaks.com/topic/26246-combining-two-in-a-function/ Share on other sites More sharing options...
trq Posted November 5, 2006 Share Posted November 5, 2006 [code]<?php if (!isset($_POST['submit'])) { echo "<form method='post'>"; echo "select the hour"; echo " <select name='hours'>"; for ($i = 0; $i < 24; $i++) { echo " <option value='$i'>$i</option>"; } echo " </select>"; echo "select the minute"; echo " <select name='minutes'>"; for ($i = 0; $i < 60; $i++) { echo " <option value='$i'>$i</option>"; } echo " </select>"; echo " <input type='submit' value='submit'>"; echo "</form>"; } else { if (isset($_POST['hours']) && isset($_POST['minutes'])) { echo "the time selected was " . $_POST['hours'] . ":" . $_POST['minutes']; } }?>[/code] Link to comment https://forums.phpfreaks.com/topic/26246-combining-two-in-a-function/#findComment-120073 Share on other sites More sharing options...
Don. Posted November 9, 2006 Author Share Posted November 9, 2006 Hi Thorpe,Thanks for the reply.Unfortunately ive got several dates and times on the page, so it would be impractical to ask the user to click submit each time they set a date or time.I'll just use individual selects and then combine the results once the form has been posted. Link to comment https://forums.phpfreaks.com/topic/26246-combining-two-in-a-function/#findComment-122035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.