Jump to content

garteth

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

garteth's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. but I am already using sessions for my login script so how would i go about doing this? Could you give me an example of the code you would use.
  2. Sorry that is actually there i just cut off what was before it. So do you think that there is anyway that I can post the form details, print them to the page and then send the input field values to another page(now.php)?
  3. Ok I see your point on the separate tags. Below I have my form code: <form method="post" name="chooseDateForm" id="chooseDateForm" action="member-index-period.php"> <input type="hidden" name="MAX_FILE_SIZE" value="524288"> <fieldset> <legend>Test date picker form</legend> <ol> <li> <label for="startdate">Start date:</label> <input name="startdate" id="startdate" class="date-pick dp-applied"> </li> <li> <label for="enddate">End date:</label> <input name="enddate" id="enddate" class="date-pick dp-applied"> </li> <li> <input type="submit" name="Submit" id="Submit" value="Submit" /> </ol> </fieldset> <input type="hidden" name="submitted" value="TRUE" /> </form> Now here is the php code I use to display the results to the page: <?php require_once ('connect.php'); // Connect to the database. if (isset($_POST['submitted'])) { // Check if the form has been submitted. if (!empty($_POST['startdate'])) { $date = ($_POST['startdate']); } else { $date = FALSE; echo '<p><font color="red">Please enter the Course ID!</font></p>'; } if (!empty($_POST['enddate'])) { $date2 = ($_POST['enddate']); } else { $date2 = FALSE; echo '<p><font color="red">Please enter the Course ID!</font></p>'; } echo '<div id="pdfbutton" style="position: absolute; top:400px; right:200px;"> <img src="images/view_as_pdf.png"></div>'; $result = mysql_query("SELECT * FROM audit WHERE user = '" . $_SESSION['SESSUSER'] . "' AND date >= \"$date\" AND date <= \"$date2\""); echo "<table border='1'>"; echo "<tr> <th>Date</th> <th>Destination</th> <th>Reply</th> <th>Identifier</th> <th>IP Address</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . date("d-m-Y", strtotime($row["date"])) . "</td>"; echo "<td>" . $row['dest'] . "</td>"; echo "<td>" . $row['reply'] . "</td>"; echo "<td>" . $row['identifier'] . "</td>"; echo "<td>" . $row[origip'] . "</td>"; echo "<td>" . $row[text'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "</br>";
  4. try this <h1>Welcome <?php echo $_SESSION['SESS_CUSTOMER_NAME'];?></h1> obviously where 'SESS_CUSTOMER_NAME' is the name of the session that you have created.
  5. Hi I did what you said and nothing appeared in the pop up boxes. I have taken out the pdf code and used the following for now.php in order to see if it will print the values. <?php require_once('auth.php'); ?> <?php require_once ('connect.php'); // Connect to the database. if (!empty($_GET['startdate'])) { $date = ($_GET['startdate']); } else { $date = FALSE; echo '<p><font color="red">Please enter the Course ID!</font></p>'; } if (!empty($_GET['enddate'])) { $date2 = ($_GET['enddate']); } else { $date2 = FALSE; echo '<p><font color="red">Please enter the Course ID!</font></p>'; } echo "$date"; echo "$date2"; Also I should mention that the link to the now.php is dynamic and is created once the query has run. If I click it once the query has run then the JavaScript does not do its job, but if I create the link as a static html link and then type in the two values and click the button the it works.
  6. They are input boxes. Its just like any normal HTML form that is posting data and querying a mysql database and returning the results, however after the results are displayed I want to grab the dates that were input
  7. Hi I am wanting to create a site that will allow a user to input to and from dates and then display the results onto a page using php and mysql. Once the results are on the page they can have the option of exporting the results to PDF. I am currently using dompdf to create the PDF however it seems as though once the submit button has been pressed the PHP grabs the values entered in the fields and turns them into variables. This is fine and is obviously what I need to happen in order to display the data onto the page. The only thing is that I want JavaScript to also grab the values if the export to pdf button is clicked and redirect to another page which creates the pdf. The code below is what I am using to do this: $('#pdfbutton').click(function() { var start = $('#startdate').val(); var end = $('#enddate').val(); window.location.replace("now.php?startdate=" + start + "&enddate=" + end); }); The only thing is when you click the button it redirects with no values in the URL. Does anyone have any ideas of how to get around this? Thanks
  8. Brilliant Thank you very much for your help.
  9. Hi I have a problem where I want to display all of the SMS messages a user has sent within this month, however the date format within mysql is YYYY-MM-DD. So I think what I would need is a way for the PHP query to get the current month and then select all entries within the DB that correspond to said month. Any ideas on how I would go about solving this issue? Thanks
  10. Hi I am currently working my way through this tutorial which will produce a pop up calendar. Something that is really annoying though is that where there should be a small calendar next to the textfield I have 2 small calendars. I have provided my code and an attached screenshot. Thanks !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>jQuery datePicker simple datePickerStartEnd demo</title> <!-- firebug lite --> <script type="text/javascript" src="firebug.js"></script> <!-- jQuery --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <!-- required plugins --> <script type="text/javascript" src="date.js"></script> <!--[if IE]><script type="text/javascript" src="scripts/jquery.bgiframe.min.js"></script><![endif]--> <!-- jquery.datePicker.js --> <script type="text/javascript" src="jquery.datePicker.js"></script> <!-- datePicker required styles --> <link rel="stylesheet" type="text/css" media="screen" href="datePicker.css"> <!-- page specific styles --> <link rel="stylesheet" type="text/css" media="screen" href="demo.css"> <!-- page specific scripts --> <script type="text/javascript" charset="utf-8"> $(function() { $('.date-pick').datePicker() $('#start-date').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#end-date').dpSetStartDate(d.addDays(1).asString()); } } ); $('#end-date').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#start-date').dpSetEndDate(d.addDays(-1).asString()); } } ); }); </script> </head> <body> <div id="container"> <h1>jquery.datePicker example: linked datePickers with start and end dates</h1> <p><a href="index.html">< date picker home</a></p> <p> The following example displays how you can synchronise two date pickers together. A common scenario for an online date picker is when booking flights or something where you need to input outbound and inbound dates. The start date must be before the end date and vice versa. We can enforce this rule with a very simple little bit of script. </p> <form name="chooseDateForm" id="chooseDateForm" action="#"> <fieldset> <legend>Test date picker form</legend> <ol> <li> <label for="start-date">Start date:</label> <input name="start-date" id="start-date" class="date-pick dp-applied"><a href="#" class="dp-choose-date" title="Choose date">Choose date</a> </li> <li> <label for="end-date">End date:</label> <input name="end-date" id="end-date" class="date-pick dp-applied"><a href="#" class="dp-choose-date" title="Choose date">Choose date</a> </li> <li> <label for="test-select">Test select:</label> <select name="test-select" id="test-select" style="width: 170px"> <option value="1">Test SELECT </option> <option value="2">Doesn't shine through</option> <option value="3">Even in IE</option> <option value="4">Yay!</option> </select> </li> </ol> </fieldset> </form> </body> </html> [attachment deleted by admin]
  11. That would be the right answer but I have realised that I left out a few details. What I really have is the following value in a field within my database: 20110523094726.BmmW The first part is the year/month/day hh:mm:ss I want to be able to strip the .BmmW off of the end and then print the date and time as follows: 09:47:26 23/05/2011 Do you know of any way that I can accomplish this? Would I need to do it before calling: echo "<td>" . $row['smsident'] . "</td>"; *smsident is the field containing the value. Thanks
  12. Ironmask you were 100% correct, cannot believe that I did not see that. Thanks very much for everyone's help
  13. Really because when I write include ('connect.php'); at the top I get this message: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
  14. Can anyone tell me how I would need to change my query so that I can use require_once('mysql_connect.php'); instead of having to write my database details into the php file. $result = mysql_query("SELECT * FROM smsaudit WHERE smsuser = '" . $_SESSION['SESS_SMS_USER'] . "'"); while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . strrev($row['smsident']). "</td>"; echo "<td>" . $row['smsuser'] . "</td>"; echo "<td>" . $row['smsdest'] . "</td>"; echo "<td>" . $row['smsreply'] . "</td>"; echo "<td>" . $row['smsidentifier'] . "</td>"; echo "<td>" . $row['smsorigip'] . "</td>"; echo "<td>" . $row['smstext'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "</br>"; ?> currently I am connecting like so: mysql_connect ("#####", "#####","######") or die (mysql_error()); mysql_select_db("#####");
  15. Just realised that the string reversal was not completely successful. I have a date format which I wanted altered 20110523 This reversed as 32501102 but what I wanted was 23052011 I have read about the explode() function and the ability to separate a string into parts and then echo them into the right order, but is there a way of doing this for what I want to accomplish? Can I use the explode function and say characters 1-4 will be named part1, characters 5-6 will be part2, and characters 7-8 will be part3?
×
×
  • 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.