Jump to content

Recommended Posts

I need help with this form I'm trying to get the date and time to post into the mysql database together

 

<div id="line">Create an Event</div>

 

<div id="events_create">

 

<form name="tryst" action="" method="post" enctype="multipart/form-data" id="tryst">

<input type="hidden" id="hidval" name="hidval" value="5g1f3"/>

 

<div id="events_create_left">

 

<div id="form_row">

<div id="form_item">Title:<span class="error">(Required)</span></div>

<div id="form_value"><input name="title" id="title" size="40" /></div>

</div>

 

<div id="form_row">

<div id="form_item">Event Photo</div>

<div id="form_value">

<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />

<input type="file" name="upload" size="30" />

</div>

</div>

 

<div id="form_row">

<div id="form_item">Location:<span class="error">(Required)</span></div>

<div id="form_value"><input name="location" id="location" size="40" /></div>

</div>

 

<div id="form_row">

<div id="form_item">City<span class="smallleft">(Enter a Zip Code)</span>:<span class="error">(Required)</span></div>

<div id="form_value"><input name="zipcode" id="zipcode" value="<? echo "$thisZip" ?>" />

</div>

</div>

 

<div id="form_row">

<div id="form_item">Type Of Event<span class="error">(Required)</span></div>

 

<label><input type="radio" name="tryst_type" value="Lunch Date" id="tryst_type_1" />Lunch Date</label>

 

<label><input type="radio" name="tryst_type" value="Dinner Date" id="tryst_type_2" />Dinner Date</label>

 

<label><input type="radio" name="tryst_type" value="Hotel Party" id="tryst_type_3" />Hotel Party</label>

 

<label><input type="radio" name="tryst_type" value="Private Party" id="tryst_type_4" />Private Party</label>

 

</div>

 

</div>

 

<div id="events_create_right">

 

 

 

<div id="form_row">

<div>Date:</div>

</div>

 

<div class="medleft" id="events_create_row">

 

<?php

 $myCalendar = new tc_calendar("date_lunch", true, false);

 $myCalendar->setIcon("calendar/images/iconCalendar.gif");

 $myCalendar->setDate(date("d"), date("m"), date("Y"));

 $myCalendar->setPath("calendar/");

 $myCalendar->setYearInterval(1945, date("Y")+1);

 $Ydate=date("Y")+1;

 $Ydate.="-".date("m");

 $Ydate.="-".date("d");

 $myCalendar->dateAllow("1945-01-01", $Ydate );

 $myCalendar->setAlignment("left", "bottom");

 $myCalendar->writeScript();

?>

 

</div>

 

 

 

 

<div id="events_create_row">

 

<div id="events_create_hour">

<select name="hour">

  <option value="1">01</option>

  <option value="2">02</option>

  <option value="3">03</option>

  <option value="4">04</option>

  <option value="5">05</option>

  <option value="6">06</option>

  <option value="7">07</option>

  <option value="8">08</option>

  <option value="9">09</option>

  <option value="10">10</option>

  <option value="11">11</option>

  <option value="12">12</option>

</select> 

</div>

 

<div id="events_create_minute">

:

<select name="minute">

  <option value="00">00</option>

  <option value="01">01</option>

  <option value="02">02</option>

  <option value="03">03</option>

  <option value="04">04</option>

  <option value="05">05</option>

  <option value="06">06</option>

  <option value="07">07</option>

  <option value="08">08</option>

  <option value="09">09</option>

  <option value="10">10</option>

  <option value="11">11</option>

  <option value="12">12</option>

  <option value="13">13</option>

  <option value="14">14</option>

  <option value="15">15</option>

  <option value="16">16</option>

  <option value="17">17</option>

  <option value="18">18</option>

  <option value="19">19</option>

  <option value="20">20</option>

  <option value="21">21</option>

  <option value="22">22</option>

  <option value="23">23</option>

  <option value="24">24</option>

  <option value="25">25</option>

  <option value="26">26</option>

  <option value="27">27</option>

  <option value="28">28</option>

  <option value="29">29</option>

  <option value="30">30</option>

  <option value="31">31</option>

  <option value="32">32</option>

  <option value="33">33</option>

  <option value="34">34</option>

  <option value="35">35</option>

  <option value="36">36</option>

  <option value="37">37</option>

  <option value="38">38</option>

  <option value="39">39</option>

  <option value="40">40</option>

  <option value="41">41</option>

  <option value="42">42</option>

  <option value="43">43</option>

  <option value="44">44</option>

  <option value="45">45</option>

  <option value="46">46</option>

  <option value="47">47</option>

  <option value="48">48</option>

  <option value="49">49</option>

  <option value="50">50</option>

  <option value="51">51</option>

  <option value="52">52</option>

  <option value="53">53</option>

  <option value="54">54</option>

  <option value="55">55</option>

  <option value="56">56</option>

  <option value="57">57</option>

  <option value="58">58</option>

  <option value="59">59</option>

</select>

</div>

 

<div id="events_create_timeofday">

<select name="ampm" id="ampm">

<option>am</option>

<option>pm</option>

</select>

</div>

 

</div>

 

<div id="form_row">

<br/>

<div>Description:<span class="error">(Required)</span></div>

<div><textarea name="description" cols="40" rows="10" id="description"></textarea></div>

 

</div>

 

<div id="form_row"><input type="submit" name="submit" id="submit" value="Post an Event" /></div>

 

</div>

 

</form>

 

</div>

 


<?

 

if(isset($_POST["submit"])=="events" && $_POST["hidval"]=="5g1f3")

{

 

 

 

if(isset($_POST['date_lunch']) && $_POST['date_lunch'] != '')

{$cal = trim($_POST['date_lunch']);}

else{$cal = false;}

 

if(isset($_POST['hour']) && $_POST['hour'] != '')

{$hour = trim($_POST['hour']);}

else{$hour = false;}

 

if(isset($_POST['minute']) && $_POST['minute'] != '')

{$minute = trim($_POST['minute']);}

else{$minute = false;}

 

if(isset($_POST['ampm']) && $_POST['ampm'] != '')

{$ampm = trim($_POST['ampm']);}

else{$ampm = false;}

 

$mytime = ($hour:$minute:"")

 

if($cal)

{

 

echo "$mytime";

 

}

else"MISSING INFO";

 

}

?>

Link to comment
https://forums.phpfreaks.com/topic/276107-date-and-time-form/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.