Jump to content

ilovephp

Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

ilovephp's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi, thanks for reply. i have done it by using hidden input type and call by $_POST. thanks alot
  2. Here is the code for displaying the success approval date whichretrieved from database:- <?php if(isset($_POST['find'])) { $dateid = $_POST['find']; $sql = "SELECT * FROM application as app INNER JOIN success_app as appdate ON app.app_id = appdate.app_id WHERE app.app_id = '$appid' AND app.date_id = '$dateid'"; $result = mysql_query($sql); echo "accept date:"."<br/>"; while($accept = mysql_fetch_assoc($result)) { echo $accept['success_date']; } } ?> how can i get the $accept['success_date']; to be displayed in my php mailer body if my codeis as below:- $mailbody = $mailbody . "Success date :".$_POST['date']."n"; i have tried with hidden input to get the value to be displayed, but failed to do so.what about array? anyone can assist me on this?thank you so much.
  3. Hi, thanks for your reply.Here is my HTML form coding. <form id="date_status" name="date_status" method="post" action=""><label>Date:- <b>FROM</b></label><input type="date" name="ldatefrom" value="<?php echo $datefrom;?>" disabled><label><b>TO</b></label> <input type="date" name="ldateto" value="<?php echo $dateto;?>" disabled><br> <?php$startDate = strtotime($datefrom); $endDate = strtotime($dateto); $date = $startDate; while( $date <= $endDate) { echo "<input type='hidden' name='nondate[]' value ='".date('Y-m-d', $date)."'>"; echo "<input type='checkbox' name='date[]' value ='".date('Y-m-d', $date)."'>"; echo date('Y-m-d', $date) .' '; $date = strtotime('+1 day', $date); }?> <br/><input id="submit_hod" type="submit" name="submit"> <br> </form>
  4. it did redirect to the home.php but without insert all the unchecked check box value into database. i got no idea how to make user did not select any of the checkbox and click submit and it will insert all the unchecked check box value into the unchecked table in the database with the code i write above.
  5. is it possible to make INSERT all checkbox values into database when there is not even one checkbox being checked since im using array_diff as shown below? my problem currently facing is, when there is a checkbox being checked, it will insert into checked_table and the remainder options which did not selected will insert into unchecked_table.howewer, when all checkbox didnt being selected, and click on submit button, the value didnt send to my database unchecked_table. <?php include('connect.php'); $checked = ($_POST['date']); $unchecked = ($_POST['nondate']); $diff = array_diff($unchecked,$checked); if(isset($_POST['date'])) { foreach ($_POST['date'] as $dateValue) { $insert="INSERT INTO checked_table ($colm_ladate) VALUES ('$dateValue')"; mysql_query($insert); } echo header("location:home.php"); } if (isset($_POST['nondate'])) { foreach ($diff as $dateValue2) { $insert2="INSERT INTO unchecked_table($colm_lrdate) VALUES ('$dateValue2')"; mysql_query($insert2); } echo header("location:home.php"); }?>
  6. Thanks alot! i made it! the date values have been successfully inserted into database.
  7. Hi all, i would like to ask, how to insert the CHECKED check box date value into database (checked_table) and insert the UNCHECKED check box date value into database (unchecked_table)? can someone please assist me on this matter? if my code is as shown below:- thank you very much. $startDate = strtotime($datefrom); $endDate = strtotime($dateto); $date = $startDate; while( $date <= $endDate) { echo "<input type='checkbox' name='date' value ='".date('d-m-Y', $date)."' class='chk'>";echo date('d-m-Y', $date) .' '; $date = strtotime('+1 day', $date); } <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script><script src="http://code.jquery.com/ui/1.9.1/jquery-ui.min.js" type="text/javascript"></script><script type="text/javascript"> $(document).ready(function () { $("#submit_hod").click(function() { getValueUsingClass(); }); }); function getValueUsingClass(){ var chkArray = []; $(".chk:checked").each(function() { chkArray.push($(this).val()); }); var selected; selected = chkArray.join(',') + ","; if(selected.length >= 1){ alert ("done insert selected date"); }else{ alert ("error"); }}</script> <label>Date:- FROM</label><input type="date" name="ldatefrom" value="<?php echo $leavedatefrom;?>"><label>TO</label> <input type="date" name="ldateto" value="<?php echo $leavedateto;?>"><input id="submit_hod" type="submit" name="submit">
×
×
  • Create New...