Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Everything posted by Don E

  1. if numb's value is an actual id for an html element, then var q = document.getElementById(numb).value; should work; without the double quotes and plus signs.
  2. Hello, It looks like you're missing the opening and closing braces { } for the for loop. Also to note, the times variable, you can set it inside the for loop instead, like this: for(var times = 1; times <= 12; times++)
  3. JSG, Is that jQuery mixed with PHP?
  4. For what it's worth, I give you thumbs up for typing all that to illustrate your question/post.
  5. Don E

    php

    Just wondering, who is your current host? Today, most host companies support PHP.
  6. is that all the code? Are you fetching from the database table like the following: $row = mysqli_fetch_array($sql);
  7. Is it possible his php.ini upload settings are not set correctly or even disabled all together?
  8. It means the $_FILES array has an undefined index called file. This usually is because of something not right on the webpage that contains the form which uploads to the PHP script that processes the form. In your form upload file, try giving the name attribute another value instead of "file": <input type="file" name="file" id="file"><br> I don't know if it's causing your undefined index problem, but it may be possible because of having the id and name attributes with the name value: "file". Also make sure your webpage has a doctype: <!DOCTYPE html>
  9. It appears you forgot to create a date object in the orderReady function. I adjusted the orderReady function abit: function orderReady(orderTime){ var dateToday = new Date(); dateToday.setDate(dateToday.getDate()+orderTime); var due_date = dateToday.getMonth()+"/"+dateToday.getDate()+"/"+dateToday.getFullYear(); document.getElementById("duedateField").value=due_date;}
  10. Don E

    [deleted]

    Sorry to hear tnd1000. Hopefully you'll figure everything out. Edit: How exactly did you know it was the Chinese? Just wondering.
  11. Don E

    Help me on Array

    It means the same as: $var[] = array(); But with: $var[] = array ('a' => 'b', 'c' => 'd');you're filling in the array that gets added to the end of the $var array with values. It will look like this if you print_r $var:Array ( [0] => apples [1] => oranges [2] => grapes [3] => Array ( [a] => b [c] => d ) ) index 3 of the $var array has an array and that array has it's first index labeled 'a' and it's value is b. The second index is labeled 'c' and it's value is 'd'. Arrays with named keys/indexes are called Associative Arrays.
  12. Don E

    Help me on Array

    The first one assigns an array to $var. The second one adds an array to the end of the $var array. So if the $var array looks like this:$var = array('apple', 'orange', 'grapes'); Then you do this:$var[] = array(); After doing that, the $var array should look like this: Array ( [0] => apples [1] => oranges [2] => grapes [3] => Array ( ) ) <?php$var = array('apples', 'oranges', 'grapes');$var[] = array(); print_r($var); //prints the contents of the $var array?>
  13. For instance, you can check if the users' email address is already in the database table... if it is that means that particular user is already signed up.
  14. Hey Jim, I'm not too familiar with jquery but the following code may give you insight on what you're probably missing in your code that's not allowing it work: <!doctype html><html><head><meta charset="UTF-8"><title>Form radio button checking</title> <script type="text/javascript"> function checkValue() // if you pass the form, checkValue(form){ var form = document.getElementById('formBuzType'); // if you passed the form, you wouldn't need this line. for(var i = 0; i < form.buztype.length; i++) { if(form.buztype[i].checked) { var selectedValue = form.buztype[i].value; } } alert(selectedValue); return false;} </script> </head> <body> <form id="formBuzType" method="post" action="#" onSubmit="return checkValue();" > <!-- you can pass the form here as well by doing: return checkValue(this); --><input type="radio" id="1" name="buztype" value="1"> petshop<br> <input type="radio" id="2" name="buztype" value="2"> salon spa <br> <input type="radio" id="3" name="buztype" value="3">medical <br><input type="submit" value="Submit"/></form></body></html>
  15. This may be of some help: http://www.w3schools...dio_checked.asp Or you can try this: Say the id for the form above is: id="formBuzType" var form = document.getElementById('formBuzType'); // loop through the radio buttons to find which one is checked, then set var valueSelected to the value of the selected radio button for(var i = 0; i < form.buztype.length; i++) // buztype is the name of the radio buttons which is an array; ie buztype[0].value is 1, buztype[1].value is 2, buztype[2].value is 3 based on what you have above. { if(form.buztype[i].checked) { var valueSelected = form.buztype[i].value; } } Hope this helps.
  16. That would not be secured because anyone can view that by viewing the source through the browser and see what the password is. It is recommended for passwords to be processed/handled on the server side.
  17. For the while condition, try using && instead of ||
  18. Did you also intend to echo: $max_first["change_car"]; ? If so, you may have forgotten to include echo before $max_first["change_car"];
  19. In order to not have any repeats, you have to somehow figure out what images the user has viewed and not let those particular images show up on refreshes/reloads/visits for that particular user. One way to do it would be cookies but JavaScript cookies can be a bit complicated so I suggest something more of the server side language cookiies or sessions. Perhaps there are other ways but you have to somehow "save" the info for what images the user has viewed other than on the current webpage because every time the page is loaded, everything on that page starts over so to speak. So for example, say you created a JavaScript array or object to record the viewed images, when the user refreshes or visits again, the record for the previous viewed image(s) will be lost. Server side language like PHP for example makes handling sessions and cookies pretty easy which allow what you're asking for to be more easier to do. The following is an example: <?phpsession_start(); if(!isset($_SESSION['images'])){ $_SESSION['images'][] = '<a href="page1.html">img1</a>'; $_SESSION['images'][] = '<a href="page2.html">img2</a>'; $_SESSION['images'][] = '<a href="page3.html">img3</a>'; $_SESSION['images'][] = '<a href="page4.html">img4</a>'; $_SESSION['images'][] = '<a href="page5.html">img5</a>'; $_SESSION['randomNums'][] = 0; $_SESSION['randomNums'][] = 1; $_SESSION['randomNums'][] = 2; $_SESSION['randomNums'][] = 3; $_SESSION['randomNums'][] = 4;} ?> <!doctype html><html><head><meta charset="UTF-8"><title>Random Img, no repeat; php</title></head> <body><div id="imgContainer"><?php if(!empty($_SESSION['images']) && !empty($_SESSION['randomNums'])){ $current = array_rand($_SESSION['randomNums'], 1); $img = $_SESSION['images'][$current]; echo $img; array_splice($_SESSION['images'], $current, 1); array_splice($_SESSION['randomNums'], $current, 1);} /*if(empty($_SESSION['images'])) // uncomment for images to start over after all 5 have been viewed{ unset($_SESSION['images']);}*/ ?></div></body></html>
  20. I believe innerHeight is part of the window object... So try: window.innerHeight;
  21. Yes I recommend taking a notepad with you. Stepping away from your computer is good when needed because allows you to take focus away from the project(or problems/conflicts you're having) at hand and allows your mind/brain to relax. As you do this, this can allow ideas to flow to you more easily than if you were still sitting in front of the computer. I do the walks too sometimes and when walking, ideas come to me about whatever I am trying to do and I say to myself "why didn't I think about that before?!" Makes you wonder why those big tech companies like Facebook and/or Google have awesome recreation areas/rooms for their employees.. I doubt its ONLY for "having fun" but also for a way for them to step away from their desks and to allow them selves to relax and unwind from the stresses they may be experiencing at the current moment.
  22. For me, it's sleep. I have found that whenever I'm not able to focus, or "not in the mood" to write etc, I realize it's simply because I didn't get adequate amount of sleep the night prior. When trying to write when you barely slept, it can be difficult because you're not as focused and simple things like syntax for example can become mistakes. Critical thinking to solve a programming problem goes out the window for me with no sleep as well. Another thing for me is the environment; it can take me out of focus if it's too noisy/loud, uncomfortable, etc. I need a nice, quiet, comfortable environment. For instance, I currently bought an iMac because of how quiet it is(one of the many reasons). Before I had a powerful windows machine with a lot of case fans that made the machine very noisy resulting in my focus being hindered sometimes. Other times it's just not "feeling" the motivation because sometimes the "task" is not motivating for me enough. For example: when I made the page on my site that deals with resizing images, I wasn't too motivated at first because what came first to mind was a simple page that resizes a users' image. I wasn't "feeling" that for some reason, but then I thought to myself how can I make it more interesting(for me that means challenging)? Then from that an idea came where I would give the user the option to resize many pictures at once. I thought to myself "hmm not bad, would be interesting and a challenge to yourself" which resulted in me being motivated. So then I started to work on it, but then I thought, what if a user selects a wrong file type in that batch of images to be resized... should I stop the process immediately? I thought to myself, no... instead allow the images with the correct files types to be uploaded and resized and the incorrect ones to NOT be uploaded/resized but allowing the resize process for the correct file types to continue and after the process is over, display the resized images for the user and then also display the "errors" they made during the resize process as well.Another one that may take some out of focus is simply... "thinking" programming is what you really want to do but deep down, it is not. But some still try to do it because of well.. "thinking" its what they want to do(in life) and A LOT force themselves to do it(for various reasons, one is: $). This is not really good imo because it would be like swimming against the tide every time or trying to swim up river when the river is flowing down river resulting in little or not results really. I'm not saying this is you, I'm just stating. :)Well, hopefully you'll find your groove back soon.
  23. Don E

    textarea format

    This may be of some interest to you: http://www.tinymce.com/
  24. Just wanted to give a quick update incase anyone ever has the same question... if you can't afford true dedicated hosting, meaning where you site is the only site on the server, then ask your hosting provider if they have a step higher than the hosting you're currently on. For example, Pro hosting. I upgraded to pro hosting and found out that before on the regular hosting, I was sharing a server with over 1000 other websites! Now since I switched over to pro, I'm on a server with 18 sites(myself included). I noticed noticeable results/performance, was really worth it.
  25. Don't know if this could be the problem... but try renaming the created div to something else incase there is a confusion between that var and the function name newDiv. Also not sure if this line is intended: document.getElementById('content').insert ? Not saying that could be the problem, just noticed it.
×
×
  • Create New...