Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. When you throw a bunch of class-related code at us and give us way too much to look at without fully understanding the goal, it makes us not want to help you. Try debugging each of your methods to be sure that they are doing EXACTLY what you expect. Once you are happy with them, do the same debugging with your surrounding logic to be sure that you are giving those methods what they expect and that the returns are what you expect still. When you get down to one single point of contention - show us that roadblock and tell us what is not working.
  2. Your output seems to be exactly what you are echo-ing. If you want it formatted, do it with your echo or simply add another echo to output a line break. (inside the loop). As for missing items and the limit 1 points - show us that code if you want to discuss it.
  3. What do you mean "how to display" your checkbox on a get. The incoming query string will look like: checkboxname=checkboxvalue. Of course if you don't have an actual value= attribute on your checkbox tag (as I pointed out earlier), then 'checkboxvalue' may be non-existent in the string. A better checkbox tag: echo "<input type='checkbox' name='chkbox1' id='chkbox1' value='1'> <label for='chkbox1'>Selection 1</label>"; Here I assign a value of '1' to the choice of 'Selection 1'. You can just as well use 'Selection 1' in your value attribute, but that is up to the situation you are in.
  4. Why do you need to do this with JS in real time? Simply have the uses submit the form with the entered times and let php do the work.
  5. In that case - forget my comment. As for your problem though - do you understand what I posted?
  6. ?? I said "What URLs". You aren't showing any urls in your example, so I'm confused as to what you want to work on.
  7. That's not how you mix in your vars to the JS function. You can't use php in a js function since one is client-side and the other is server-side. Make you js function retrieve the values you want from the dom by using simple js things such as getElementById. (google it). Ps - Is English not your normal language? Cause if it is, how are you ever able to spell php functions correctly?
  8. Pdo does not have to be used as OOP. I use it strictly in procedural mode and find it very easy to use. $q = "select * from (table) where key1= :mykeyvalue1"; // note use of : in the key argument here $qst = $pdo_conn->prepare($q); // $pdo_conn is created in a separate piece of connect logic that one can easily write in an included module if (!qst) echo "error doing prepare"; $qst->execute(array('mykeyvalue1'=>$key1)); while ($row = $qst->fetch(PDO::FETCH_ASSOC)) { (process the returned rows) } Hope this makes it clearer.
  9. Yes - it is php code and s/b at the top along with all of your php code (and not your html) whenever you are developing your scripts.
  10. Except you mixed your html and php code together.
  11. With all that input I would not use a GET for my input. Set your form method to be POST instead. Also - your checkboxes don't have a value clause which is usual. Of course you still have to check if they are set but then you can simply use the value as the value to be saved. if (isset($_POST['checkbox1'])) $checkbox1 = $_POST['checkbox1']; else $checkbox1 = 0; // or whatever you want saved
  12. Turn on error checking to see if something is wrong with your script. See my signature.
  13. "Login system"? Is this something more than a simple form that asks for a user id and password? I've not heard it referred to as a 'login system' before. Normally it is simply the form and some logic and a db query to check the entries or to save them.
  14. 1 - create your text file and store it outside of your web-accessible tree for security purposes. 2 - create a small php script that contains a function that has two arguments - user and password. 3 - in this function open the text file and start a loop on it to read the lines one at a time. 4 - match the user and password argument against the contents of the current line you just read. If it matches, set the cookie and return true from the function 5 - if it doesn't match, read the next line from the text file and repeat step 4 6 - if you reach the end of the file and exit the loop, return false.
  15. Maxdd - I rarely use oop. Small projects, not enough repetition to warrant classes, use includes for standards pieces of code. Hansfore - function does stand out on the function header, but in use that word isn't obvious! Of course, function names in php are case-insensitive so it doesn't matter but it's just one of my own conventions.
  16. as Maxdd says commenting a much ignored attribute of programmers. Sometimes when we get deep into a process and develop some code to do some tricky maneuver we lose all sense of it just a couple of months later when we come back to 'tweak' it a bit. Comments about your thought process when you write something are essential! Unfortunately, I can't agree with Maxdd on his use of camelcase for naming things. It's bad enough that JS endorses it - there is no reason for you to introduce it in your own code. A needless distraction in my opinion since it leads to many errors during development where you inadvertently leave out a capital letter which PHP will not catch and WILL give you an error or worse. IMHO - stick to all lowercase for your vars. Another of my preferences is to use initial caps on my own function names just to make them stand out. MyFunctionName() versus myFunctionName() or myfunctionname().
  17. Sorry about my previous post. For some reason the forum is acting strangely today. I did not spread my code out like that intentionally.
  18. $first = true; while($row = mysqli_fetch_assoc($result)) { if ($first) { $first = false; continue; } ... ... ...
  19. Great question! More people should think like you! There are lots of preferences on "how to indent". So what I'm showing you is just my personal choice. I believe it gives one an easier view of the code and makes it much quick to browse thru code looking for "blocks" of statements. I indent any block of code that is wrapped in curly braces ( { }). I indent any single lines that are part of an if else statement. I indent all function code, again because it is inside those braces. I indent if statements that are inside other if statements (of course, I try not to nest too many if statements). Below is a sample ( I hope the site shows it accurately) of what my code would look like: php line php line php line if (condition) { tabbed line tabbed line } else tabbed line php line php line php line //****************** //****************** function MyFunction() { php line php line php line } ( I see that the forum added blank lines between my original input. Oh, well....) (note that this code was posted using the proper code tags for this forum ('php' and '/php' wrapped in square brackets) Also it is encouraged to separate your main html code away from your php code. Too many people think in a straight line as they write a script and begin by beginning the html document before they do any php. Start your script with the initialization you need (a session_start is always a good start), determine what you need to do in your php, then do it and save any dynamic information to be displayed in php vars and at the end of your processing output the html document in its entirety, including those php vars where the data they contain should be displayed. Some html may be generated by the php process, such as building a drop-down box or an html table but that should all be in a loop that is producing the data to be contained by them and therefore makes sense.
  20. YOu need to show us some contiguous code here. A radio button only returns one selection so there is no need for a loop. Show us the whole code where you build your html (the query that produces the data would be nice) and then how you completely receive the data. We can't possibly understand what you mean by having multiple ids in one radio button.
  21. I'd like to see the code that you actually used to receive the input values from your html. PS - why do you use a loop on the radio button input when there will only be one?
  22. Strange? What happened when you set your column widths as I suggested?
  23. The url that would be used is: domain.com/mypage.php?quitdate=x To receive that value in your script you need: if (isset($_GET['quitdate'])) $quit_date = $_GET['quitdate']; else (handle a missing argument however you wish) Of course you then need to validate that value to be sure it is something you expect
  24. If you want: 21, 33, b4, 42 You need to output that: echo "$key$val, "; If you don't want that, I'm not sure what you are asking for.
×
×
  • 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.