Jump to content

tryingtolearn

Members
  • Posts

    293
  • Joined

  • Last visited

  • Days Won

    1

tryingtolearn last won the day on November 1 2014

tryingtolearn had the most liked content!

Profile Information

  • Gender
    Not Telling

tryingtolearn's Achievements

Regular Member

Regular Member (3/5)

8

Reputation

  1. Depending on how you are getting your data from the DB here is one way if the row is called UID echo'<a href="detils.php?UID='.$row['UID'].'">Link Text</a>';
  2. This seemed to do the trick Not exactly sure what throws the error above or why its considered an error since both versions work.. // file selection function FileSelectHandler(e) { var i, files, f; // cancel event and hover styling fileDragHover(e); // fetch FileList object files = e.target.files || e.dataTransfer.files; // process all File objects for (i = 0; i <= files.length - 1; i = i + 1) { f = files[i]; parseFile(f); uploadFile(f); } }
  3. Im following some examples for drag and drop file uploads and have come across the same for loop in different tutorials And get the following error (jslint) The loop for (i = 0, f; f = files[i]; i++) { ParseFile(f); UploadFile(f); } The error I tried omitting it and adding a break in the loop but it gave the same error on the break line. Trying to figure out an explanation for the error - or a way to re write the second statement to pass through jslint
  4. Hard to tell since you didn't post any code so I dont know how your page is laid out. I wouldn't use css to do that, I'd simply add that block of code where you want the username to appear.
  5. If you are storing the username in a session after a successful login On our account page add echo'Welcome'; if (isset($_SESSION['username'])){ echo", {$_SESSION['username']}"; } changing username to whatever you are storing username as.
  6. A few things would factor into the path you take Things like What kind of site? What parts of the site need to be multilingual For instance, the site documents might need to be translated but a site forum wouldn't need every message translated just the categories. Then you would have to think about currency on an e commerce site. From the administrative standpoint who is supplying the translations and how are the translations going to be updated. etc... in a nutshell - you'd be hard pressed to get an answer on the "right" way of doing it. Not really one "right" way of doing every site. It would take careful planning and a detailed road-map before you start.
  7. print date_parse and see if it is listing any errors in the date format print_r(date_parse($monthnum));
  8. change if(is_array($answer)){ if(array_diff($qa, $answer) == array()){ $correct++; } } else if($qa === $answer){ $correct++; } to if(is_array($answer)){ if($qa === $answers[$num]){ $correct++; } } else if($qa === $answers[$num]){ $correct++; }
  9. with a combo of php and ajax you could load the video and start a timer at a set interval pause the video and load the first question Submit it and if correct resume the video and timer and continue that process... Here is a rough outline that would pass the cycle # to the php page which could be used to id the answer from the db result or however you are setting that portion up. It wont address the valid point that rwhite35 brought up about the user exiting and coming back but it could probably be worked in. index <!DOCTYPE html> <html> <head> <style> #status{ background-color: #ffdddd; } #myVid{ width:50%; float:left; } #myTest{ width:50%; float:left; visibility: hidden; } video{ width:80%; } </style> <script> var qCycle=0; function myOverlay() { ol = document.getElementById("myTest"); ol.style.visibility = (ol.style.visibility == "visible") ? "hidden" : "visible"; } function timer(time,update,complete) { var start = new Date().getTime(); var interval = setInterval(function() { var now = time-(new Date().getTime()-start); if( now <= 0) { clearInterval(interval); qCycle++; complete(); } else update(Math.floor(now/1000));},10); } function showTest(str) { if (str.length == 0) { document.getElementById("txtAns").innerHTML = ""; return; } else { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("txtAns").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "getAns.php?q=" + str, true); xmlhttp.send(); } } function myStart() { timer(10000, function(timeleft) { // called every step to update the visible countdown document.getElementById('status').innerHTML = timeleft+" second(s) left before the video will pause for the test"; document.getElementById('demo').play(); },function() { // what to do after //alert("Timer complete!"); document.getElementById('status').innerHTML = "Video paused for test cycle "+qCycle; document.getElementById('cycle').innerHTML = qCycle; document.getElementById('demo').pause(); myOverlay(); }); } function myClose() { myOverlay(); timer(10000, function(timeleft) { document.getElementById('status').innerHTML = timeleft+" second(s) left before the video will pause for the test"; document.getElementById('demo').play(); },function() { document.getElementById('status').innerHTML = "Video paused for test cycle "+qCycle; document.getElementById('cycle').innerHTML = qCycle; document.getElementById('demo').pause(); myOverlay(); }); } </script> </head> <body> <div id="status">Press Start To Begin <button onclick="myStart()">Start</button></div> <div id="myVid"> <video id="demo" src="big_buck_bunny_480p_stereo.ogg"> Your browser does not support the <code>video</code> element. </video> </div> <div id="myTest"> <div>Test Cycle:</div> <div id="cycle"></div> <p>Test Code Here.<br />Video and timer will start again when you click Resume Video</p> <p>when you hit submit it will pass the cycle # to the php page where you could use that for the question and answer reference: <br /><span id="txtAns"></span><br /><button onclick="showTest(document.getElementById('cycle').innerHTML)">Submit</button></p> <button onclick="myClose()">Resume Video</button> </div> </body> </html> php <?php // get the q parameter from URL $q = $_REQUEST["q"]; $hint = ""; if ($q !== "") { if ($hint === "") { $hint = $q; } else { $hint = "No Result Could Be Located"; } } echo $hint === "" ? "no suggestion" : $hint; ?>
  10. Assuming attendees has an id field that is unique pass that as the option value to get the details to view <option value="<?php echo $row[WHATEVER THE ID ROW IS HERE]; ?>"><?php echo $row[1],' ',$row[2]; ?></option>
  11. You have to pass the form name as the array not the id. Instead of name="q'.$QID.'" id="q'.$QID.'-'.$Value.'[]" try name="q'.$QID.'[]" id="q'.$QID.'-'.$Value.'" on your form elements.
  12. It would help to see what you changed because in my last example Arg 1 wouldn't be a string it would be an array so you shouldn't be getting the warning. There are probably a bunch of ways to make it work, the right way to me just depends on how you want it implemented to fit with how your site works. post the code your working with now and we can maybe pinpoint where things got changed.
  13. You aren't getting your data from the form in your latest example. Since you aren't setting up your form to match the answer array like my previous example try it like this Change foreach($answers as $num => $answer){ $qa = 'q'.$num; if(is_array($answer)){ if(array_diff($qa[$num], $answer) == array()){ $correct++; } } else if($qa[$num] === $answer){ $correct++; } TO foreach($answers as $num => $answer){ $qa = $_POST['q'.$num.'']; if(is_array($answer)){ if(array_diff($qa, $answer) == array()){ $correct++; } } else if($qa === $answer){ $correct++; } One note though, in this manner you will need to make all the id's in the form fields arrays even if they are fill in the blank or multiple choice radio buttons.
  14. One way could be to parse the url using the PHP_URL_PATH component to extract the /10-pages/ part Then find out if the component contains what you are looking for if it does, add your meta tag. <?php $url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $pos = strripos($url, "/10-pages/"); if ($pos !== false) { echo '<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">'; } ?>
×
×
  • 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.