Jump to content

jmahdi

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Everything posted by jmahdi

  1. answer: you can't; however, you can design your page to solve the issue. just a couple of ways 1) drop downs for day, month, year, 2) calendars thanks litebearer....
  2. in fact...i give up ... how on earth can i guess in what order the user is inputting the date? help please....
  3. how about this for a converter: $signs = array("-", "\\", "/", "*"); $rpl = str_replace($signs, ' ', $date); $d = explode(" ", $rpl); $date = mktime(0,0,0,$d[0], $d[1], $d[2]); echo $date; echo strftime("%d/%m/%Y", $date); I think this solves it....thanks again for the tip
  4. thanks for your reply and sorry for me not replying, I was just about look into applying what you had told me....I'll be back
  5. sorry i couldn't get what you mean...do you mean if the user is shown a certain format to stick to when entering the date? if you meant so, i didn't do so...
  6. when i try to enter it into mysql database it comes as 0000-00-00 00:00:00 ... thats another issue... sorry but i'm alien to date formatting
  7. Hi there, i want to convert whatever a user inputs through and html form to a DATE format which when posted will be entered (using mysql) as that particular Date format , i'm using this: $date = "12-12-11"; //assume this to be the user input $time = strtotime($date); $new_date = date("d/m/Y",$time); echo $new_date; but this format will give the output as: 11/12/2012.....is there a way to convert whatever the user enters to be: dd/mm/yyyy which gives: 12/12/2011 thanks so much
  8. Thanks a bunch PFMaBiSmAd and btellez the problem was the name , i had changed both forms names to submit and kept the value to be more specific, Save and Go for the other form. I hope this is best practice(i.e. to keep the name as submit always)?! or isn't it!
  9. Hi there I'm trying to make this form submit...but alas, is to no avail .... i have two forms on top of each other one of them is: <form name="entries_form" method="post" action="index.php"> <table> <tr> <th><label>Date</label></th> <th><label>From</label></th> <th><label>To</label></th> <th><label>Break</label></th> <th><label>Hours</label></th> <th><label>Required Hours</label></th> <th><label>Notes</label></th> </tr> <tr> <td> <input name="Date" type="text" id="Date" /> </td> <td> <input name="From" type="text" id="From" /> </td> <td> <input name="To" type="text" id="To" /> </td> <td> <input name="Break" type="text" id="Break" /> </td> <td> <input name="Hours" type="text" id="Hours" /> </td> <td> <input name="Rqrd_hrs" type="text" id="Rqrd_hrs" /> </td> <td> <input name="Notes" type="text" id="Notes" /> </td> <td> <input type="submit" name="Save" value="Save" id="Save" style="background-color:#7A70A4;" /> </td> </tr> </table> </form> to post i'm using this code (to much over the top maybe): <?php $session = new Session(); $u_id = $session->get('id'); //to get the user id from session if(isset($_POST['submit']) == 'Save'){//form's button name is Save $entry->user_id = $user_id = $u_id; $entry->date = $date = trim(strtolower($_POST['Date'])); $entry->start_time = $start_time = trim(strtolower($_POST['From'])); $entry->end_time = $end_time = trim(strtolower($_POST['To'])); $entry->breaks = $break = trim(strtolower($_POST['Break'])); $entry->total_hours = $total_hours = trim(strtolower($_POST['Hours'])); $entry->reqd_hours = $required_hours = trim(strtolower($_POST['Rqrd_hrs'])); $entry->notes = $notes = trim(strtolower($_POST['Notes'])); $entry->add_entry(); }else die("Not Posted"); ?> the add entry() function does the following: public function add_entry(){ global $database; $sql = "INSERT INTO sheetentries ("; $sql .= "user_id, date, start_time, end_time, break, required_hours, total_hours, notes"; $sql .= ") VALUES ('"; $sql .= $this->user_id ."', '"; $sql .= $this->date ."', '"; $sql .= $this->start_time ."', '"; $sql .= $this->end_time ."', '"; $sql .= $this->breaks ."', '"; $sql .= $this->reqd_hours ."', '"; $sql .= $this->total_hours ."', '"; $sql .= $this->notes ."')"; $database->query($sql); } the user_id or $u_id brought from the session when the user loggs in: $u_id = $session->get('id'); anyway, whenever i try submitting the form nothing happens, what am i missing,,, thanks in advance
  10. Its sorted now... using your suggestion... thanks
  11. thanks gizmola, I'll try altering and get back with results..thanks again
  12. I'm trying to use a boolean 'true' or 'false' to tell the page that when false, he/she is logged out and send them to loggin page..other wise display the name which is taken from the session....i made the session stuff in a class and i have it as follows: <?php include("includes/functions.php"); class Session{ public $logged_in = false; // the one i'm on about public $key; // $_session[$key] = $value public function set($key, $value){//setting session $_SESSION[$key] = $value; if(isset($_SESSION[$key])){ $this->logged_in = true; } } public function get($key){ //getting session if(isset($_SESSION[$key])){ return $_SESSION[$key]; } else{ return false; } } public function confirm_logged_in(){ //check if logged in if(!$this->logged_in) redirect_to("login.php"); // a tailored method } public function logout(){ session_start(); session_unset(); session_destroy(); $this->logged_in = false; } } $session = new Session(); ?> unfortunately when i set the session on one page (say after login) assuming that the $logged_in variable is now turned to TRUE, but when I go to another page (e.g. Index.php) and Get the allready set session and perform the test confirm_logged_in() it does the OPPOSITE to what I would expect as for example: redirecting me to login.php even when its "supposed to be" $logged_in=true as set in the set function above. any help would be appreciated...suggestions to change syntax or any as such...thanks
  13. thanks all for your help, I think the first solution did the job and its working fine now....cheers all
  14. thanks for the advice, I think this should solve it
  15. Hi there I have this problem with a button that should destroy sessions and then redirects to login page when clicked, pointing to this method: public function logout(){ $this->logged_in = false; session_start(); session_unset(); session_destroy(); redirect_to("login.php"); } the function is called as bellow: <form> <input id="logout" name="logout" type="submit" value="logout" onClick="<?php $session->logout(); ?> " /> </form> which is available on a page called index.php, which is the default page where you'll be directed to when logged in or just registered. unfortunately when I'm supposed to be to this page and before even clicking on the button, the function just does the work and redirects to the login page!!!.....any help please
  16. thanks gristoi it works.... sorry i'm new to linux, do i have to do this every time i boot linux? thanks again
  17. this should be related to an "mysterious" configuration in apache or something please help (or direct to another post that might)..... I get this: You don't have permission to access /filename.htm when i try to run http://localhost/filename.htm !! while i have no problem when running: http://localhost/filename.php i run this on linux fedora (if this helps or makes a difference)...the files are called from the /var/www/html directory.. thanks in advance
  18. its php related i suppose, and thought it might be related to php.ini file issues or something!?
  19. Hi there, this might be a little problem , but i'm new linux so hope you understand. the problem is that when i do localhost/login.htm for example it gives me this: You Don't have permission to access /login.htm on this server ...but when i do localhost/login.php for example the server is fine with it... I placed all files in /var/www/html folder , OS is linux fedora 15 thanks
  20. did you run the code i provided, because that is how to center an unordered list in the middle of the screen no matter the contents? i just tried it and i think it works, just need to make -padding:left: 0- as the the browser adds a padding-left of 40px for some reason, thanks for the help.
  21. it doesn't actually, i have to do this manually for every page...
  22. hellooo! Since you did not supply any relevant css, apart from html I think we need to guess what you need. Is it a horizontal menu? or vertical? do you have a fluid layout? or a fixed center page? here is one method that works without an additional div, since an <ul> is already a container. If it doesn't work for you be more precise and provide some useful css and what you tried, or even better an on line example. In the end we are not Human googles that respond to 'helloo' some html with a logical indention + an #ID of #menu <ul id="menu"> <li> <a href="index.htm">HOME</a> </li> <li> <a href="update.htm">MY ACCOUNT</a> </li> <li> <a href="regis.htm">REGISTER</a> </li> <li> <a href="content.htm">BROWSE MUSIC</a> </li> <li> <a href="uploaded.htm">UPLOAD MUSIC</a> </li> <li> <a href="contact.htm">CONTACT</a> </li> </ul> the css (assuming it's a horizontal menu) ul#menu {background:#f4a; width:900px; text-align: center; margin:0 auto;} #menu li{display:inline; } thanks, i know "helloo" does not get caught "robotically" in these forums , i only wanted to raise my theread so people can see... I'm using a horizontal menu, if it helps here is my css part for menu and ul: #Menu{ height: 1px; width: auto; margin: 0 auto; } #Menu ul{ list-style: none; margin: 0; } #Menu li{ float: left; margin: 0 1px; } #Menu li a{ background: url(../final/menuLink.jpg); height: 30px; display: block; padding-top: 6px; padding-left: 3px; padding-right: 3px; text-decoration: none; text-align: center; }
  23. jmahdi

    Footers

    try this: <body> <div id="Main" style="width:800px; height:800px; background: green; margin: auto; padding: 5px;"> <div id="Header" style="height:10%; background:red;"> <div id="Content" style="height:85%; background:yellow;">Content</div> <div id="Footer" style="height:5%; background:blue;">Footer</div> </div> </body> the colors show the effect
  24. jmahdi

    Footers

    maybe i can help here... you can have a main div with a certain height and and within this main div you can have a number of divs with a height set to a PERCENTAGE of that main div's height, the last div within this main div would be the footer. so for example you call the first div within the main div HEADER you can give it a height of say 15% and CONTENT div 80% and finally a FOOTER div with height 5% and this should guarantee that this footer is always at the bottom, and the leaset in size... hope this helps...
×
×
  • 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.