Jump to content

am_25

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

am_25's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks all it works. Jesirose special thanks your code works.. I tried it today
  2. I just copied and ran your code, it didnot show up anything. I'm not sure what went wrong. Thanks again
  3. with this code how to get the dates for the entire week $StartOfWeek = date("Y-m-d",mktime(0,0,0,date("n"),(date("j")-date("w")),date("Y"))); $EndOfWeek = date("Y-m-d",mktime(23,59,59,date("n"),(date("j")+(6-date("w"))),date("Y"))); echo $StartOfWeek; print "<br>"; echo $EndOfWeek;
  4. This code works well. $StartOfWeek = date("Y-m-d",mktime(0,0,0,date("n"),(date("j")-date("w")),date("Y"))); $EndOfWeek = date("Y-m-d",mktime(23,59,59,date("n"),(date("j")+(6-date("w"))),date("Y"))); echo $StartOfWeek; print "<br>"; echo $EndOfWeek; Thanks all.
  5. thanks a lot but it does not work...I guess it is too abstract for me.
  6. Is the session getting created. I had the same problem. Check you session.savepath using phpinfo(). If the folder doesnot exist create it and give write permissions. the session.savepath is in the php.ini file. One more problem which I had was using the "include" in the first line, i removed it and it worked. You can place the include file, just before u use it. But first try the session.savepath
  7. thanks But one more question. Today's date is 20th tuesday. The week starts from 19th Mon to 25th Sun I want it to be displayed like that For eg. In case the date is 23rd feb, it should display from 19th to 25th How to do that? thanks
  8. I need the dates of the week to be displayed, with respect to the current date. How can this be done?
  9. I need it to happen on the browser side. When I submit, all the contents of the form should be submitted to the DB. It is a time sheet application. Any idea if there are any tutorials. Thanks
  10. Hi, I'm doing a small time sheet application. How can I have several rows and i need each row to be created dynamically after I press Tab at the last col. Is this possible. something like a table structure. Kindly help
  11. Hi, I'm trying to use sessions for the login application. I first set the session varibables and then depending on the session i enable the other pages(like search,db entry etc). After I logout, if i put the URL of the other pages in the same browser session which need user access, it shows up as if user is logged in. But it works well if I do it in a new browser. How can I implement- after logout the user should not be able to access the pages in the same browser. a small snippet of my loginscript.php $sql="SELECT * FROM users WHERE username='$myusername' and password='$encrypted_mypassword'"; $result=mysql_query($sql); $q = mysql_fetch_object($result); if(!$q) die("Login Failure: An error occured, please verify your username and password are correct."); //set session variables $_SESSION['loggedin']=1; $_SESSION['user'] =$_POST['username']; $_SESSION['pass'] = $_POST['password']; header("Location:employee.php"); small snippet of other pages where I check for session if (!isset($_SESSION['user'])) { // check if authentication was performed // else die with error die ("ERROR: Unauthorized access!"); } else { include "connect.php"; //connection string print "<br><p align = 'center'> Employee Details </p>"; print "<table align = 'center' border=1px>"; print "<tr align = 'center' class='headline'><td>Search Employee Details</td></tr>"; print "<tr ><td>"; ..... a small snippet of my logout.php <? session_start(); //remove all the variables in the session unset($_SESSION); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } // Finally, destroy the session. session_destroy(); ?>
  12. It worked, the problem was very simple. the include "connect.php"; - line was the problem. Since this line was the first line, all the POST variables were getting lost. I removed this line of code and placed it just before where the SQL was called and viola everything worked. Thanks for all the help.
  13. How about a Time Tracker system for emp. I'm thinking of doing it myself.
  14. This works <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; $test=$_POST['test']; if ($test){ foreach ($test as $t){echo 'You selected ',$t,'<br />';} } ?> <html> </body> <form action="test.php" method="post"> <select name="test[]" multiple="multiple"> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> <option value="four">four</option> <option value="five">five</option> </select> &nbsp <input type='submit' name='submit' value='submit'> </form> </body> </html> This does not work, what can the error be, except that the values are from the DB. It is not passed in the array varible. But for a variable it works. <?php include "connect.php"; echo '<pre>' . print_r($_POST,true) . '</pre>'; if (isset($_POST['submit'])) { $test=$_POST['test']; $n=count($test); if (count($test)){ echo " you are inside the loop"; } echo "You selected ".$test." value. <br />"; if ($test){ foreach ($test as $t){echo 'You selected ',$t,'<br />';} } } ?> <html> <body> <form action="multiple.php" method="post"> <?php $sql2="SELECT distinct(designation) from empdet order by designation asc "; $result2=mysql_query($sql2);?> <SELECT name="test[]" multiple ="multiple"> <?php While ($row=mysql_fetch_assoc($result2)) { //$desi=$row['designation']; echo "<OPTION value=\"{$row['designation']}\">{$row['designation']}</OPTION>\n"; } ?></select> <input type='submit' name='submit' value='submit'> </form> </body> </html>
×
×
  • 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.