NotSunfighter
Members-
Posts
63 -
Joined
-
Last visited
-
Days Won
1
Everything posted by NotSunfighter
-
Why are you pulling everything from the db with the * when all you want is the rank? In your echo you are putting a double quote inside a double quote. => You have a rank of " . $user['rank'] . "
-
no problem Your Welcome
-
Stop using tables. Use divs for the cells. Put them in a container and flex that.
-
Not going to code this, but off the top of my head I would use Flex-box and not a table. Set it up to display as you have it above (horizon.) . Then set the flex order by row to instantly create a vertical table.
-
Was expecting the 6 blocks to be clickable.
-
SimpleXML get certain value based on a field
NotSunfighter replied to Billy-3k's topic in PHP Coding Help
Got your first foreach to work with: foreach ($xmlA->PRODUCT as $proda) { echo $proda->PRODUCT_NUMBER; echo $proda->PRODUCT_NAME; echo $proda->PRODUCT_PRINT_ID; } -
Converting and Calculating Numbers (decimal & rounding)
NotSunfighter replied to martinspire's topic in PHP Coding Help
I believe I would convert the mm entrees to meters first then get the square meters. $dimension1 = 850/1000; $dimension2 = 1447/1000; $square_metres = $dimension1 * $dimension2; The results would be 1.22995 square meters. You can use number_format() if you need to limit the number of decimal places. -
I know.
-
This is an example of LABEL with INPUT. Works down to 175px width. At this point a keyboard for input is useless. The placeholder attribute was to be a 'hint'. You give a book a title like The Long Kiss Goodnight" and a hint like P. Eye story <!DOCTYPE html> <html lang="en"> <head> <style> #find-search { background: #3a658e; padding-left: 10px; border-radius: 3px; cursor: pointer; margin-left: 5px; color:white; } #find-search:hover { background-color: #399edc } #quickfind{ font-size: smaller; } </style> </head> <body> <form action="/quickfind" id="quickfind" method="post" name="quickfind"> <label for="find-search">Quick Search</label> <input type="text" id="find-search" placeholder="Keywords"> </form> </body> </html> I'd rely on placeholders in situations like this: <!DOCTYPE html> <html lang="en"> <head> <style> #find-search { background: #3a658e; padding-left: 10px; border-radius: 3px; cursor: pointer; color:white; } #find-search:hover { background-color: #399edc } </style> </head> <body> <form action="/quickfind" id="quickfind" method="post" name="quickfind"> <label>Enter your name</label><br> <input type="text" id="find-search" placeholder="First name"><br> <input type="text" id="find-search" placeholder="Last Name"> </form> </body> </html>
-
Horrible coding practice to use a placeholder in place of a <label>.
-
How do you write a simple Listener script?
NotSunfighter replied to simona6's topic in PHP Coding Help
You have a link that the user pushes to see the number of new messages; so it most probably is done through AJAX. A listener on that link would change anything. What I think your looking for is PUSH notifications which are way above your pay grade. You could simulate push notifications with a time loop in JS to send the request every once in a while. -
This is my take on your question. Have a sign in page. This will give the user an identification. On that page list all things that are to be worked on. Identify which items are in use and which are open. Maybe back ground color etc.. The user selects what he/she wants to work on first - that assigns this page to her. Then have user pick which he wants to be notified when available. Add him to the list. You can work thing out from there.
-
Jayfromsandiego give my script a try please and post here for a little while. Let me know what you think of the script - we can fix any problems that you have with it. I am new here myself - Most posts I see here are to help people with problems. ginerjm maybe a little ruff with his answers, but he does give good advice. I think he just didn't look at what you posted very close, but he did look. When I did this my eye sight was not up to it's potential Don't go away mad - stay and get the help you need.- Just had the lids operated on, so I could not see the pictures you loaded and just went with the code.
-
The code you found looks like a training thing about Jquery and has little to do with the actual problem and more about how Jquery does really nice stuff. I wrote everything from scratch, almost. Lots of tweaking needed. Fast explanation about the JS: When page loads we set up a new XMLHttpRequest() so we can use AJAX to get to the PHP file. The rest is a function called by the 'submit' button. I use a loop to query all the input tags and count the number of radio buttons selected. This could have been a little more precise in the tag called. - 6 questions so I need 6 checked buttons. I use a IF/ELSE section for that. You will need to handle the Not Equal section. myString will be the values of the selections separated by a comma. This string is sent to my 'test5.php' file by the rest of the code - right after I remove the comma at the end of the string. In the PHP file I make a string of correct answers $mine. I then convert that string and the string I received via the $_GET[] into arrays. Followed by a for loop to compare each answer to the master array and send the outcome back to the main file, where it is posted. The main file has been moved and worked on in various browsers and text editors - I think it's good code, but at this point no guarantees cause I'm done working on it today. Main File HTML <!DOCTYPE html> <html lang="en"> <head> <title>Website - Voting Poll (Javascript)</title> <link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet"> <style> body{ font-family: 'Josefin Sans', sans-serif; } h1 { text-align: center; } #container { width:50%; margin: 150px auto; padding: 50px 30px; background-color: #3f51b5; border-radius:3px; color: #fff; box-shadow: 0 0 10px 0 #999; } ol { list-style-type: none; padding: 0; margin: 0; width: 500px; } ol li { background: #223394; width: 200px; margin: 10px; padding: 5px; } input, label{ cursor: pointer; } input[value="no"]{ margin-left: 45px; } button{ width : 70px; margin-left: 10px; } </style> </head> <body> <div id="container"> <h1>Voting Poll >> In Less Than A Minute</h1> <div id="proof"></div> <ol> <li>This is question #1<br> <label for="yes1"><input type="radio" name="q1" value="yes" id="yes1">Yes</label> <label for="no1"><input type="radio" name="q1" value="no" id="no1">No</label> </li> <li>This is question #2<br> <label for="yes2"><input type="radio" name="q2" value="yes" id="yes2">Yes</label> <label for="no2"><input type="radio" name="q2" value="no" id="no2"> No</label> </li> <li>This is question #3<br> <label for="yes3"><input type="radio" name="q3" value="yes" id="yes3">Yes</label> <label for="no3"><input type="radio" name="q3" value="no" id="no3"> No</label> </li> <li>This is question #4<br> <label for="yes4"><input type="radio" name="q4" value="yes" id="yes4">Yes</label> <label for="no4"><input type="radio" name="q4" value="no" id="no4"> No</label> </li> <li>This is question #5<br> <label for="yes5"><input type="radio" name="q5" value="yes" id="yes5">Yes</label> <label for="no5"><input type="radio" name="q5" value="no" id="no5"> No</label> </li> <li>This is question #6<br> <label for="yes6"><input type="radio" name="q6" value="yes" id="yes6">Yes</label> <label for="no6"><input type="radio" name="q6" value="no" id="no6"> No</label> </li> </ol> <button type="button" onclick="sendTest()">Submit </div> <script> var xhttp = new XMLHttpRequest(); function sendTest(){ var myObj = {"q1":"maybe", "q2":"maybe", "q3":"maybe", "q4":"maybe", "q5":"maybe", "q6":"maybe"}; var counter = 0; x = document.querySelectorAll("input"); for (i = 0; i < x.length; i++) { if(x[i].checked){ counter++; } } if(counter != 6) { document.getElementById("proof").innerHTML="ERROR"; return; }else{ for (i = 0; i < x.length; i++){ if(x[i].checked){ myString += x[i].value + ","; } } var myString = JSON.stringify(myObj); } xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("proof").innerHTML = this.responseText; } } xhttp.open("GET", "test5.php?myString", true); xhttp.send(); } </script> </body> </html> The file it calls - test5.php <?php $str= $_GET["q"]; $mine = 'yes,no,yes,no,yes,no'; $corr = 0; $wron = 0; $arr = explode(',', $str); $arry = explode(',', $mine); for ($i=0; $i<6; $i++){ if($arr[$i] == $arry[$i]){ $corr++; echo $corr.' correct<br>'; }else{ $wron = $wron + 1; echo $wron.' wrong<br>'; } } echo 'You have '.$corr.' correct and '.$wron.' wrong.'; ?> I really hope this is a giant help. If not we're always here, sort of.
-
If you want raw JS: place an id on your <li> Lets say id='myJS' and: document.getElementById("myJS").addEventListener("click", function(){ Put your code here between the curly brackets });
-
Revolutsio, I see where you have used "this is not my code I found this on youtube" on your questions before. Most YT teaching vids never post code - it has to be copied. If this is how your doing it, please verify your randision before asking for help. Chances are pretty high that the correct code, as was given on youtube, works.
-
Revolutsio, Before trying to learn PHP you should have a stronger grasp of HTML then you do. I understand your impatience with getting a web site up, but take a weekend to study your coding. I removed the PHP and corrected your HTML. Take a look and see if this is what you want. <th> tags need a matching end tag not </td> TABLES should have <tbody> tags - I added them Your <form> appears at the top so I assume you want it there, but not needed in the TABLE - coded it differently and put it on top. You define only three headers so you only have three columns in the table, It looks like you have five things that you want in the table. $output and $od have no place to go so added an Owned header I'm eliminating $output you can insert it were you want. Your missing a </td> tag. The end of the PHP is hard to find BUT it placed before you really end the WHILE loop. Your also missing the end of your PHP code ?> tag. [code] <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Page Title</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> <div id="main"> <form method="POST"> <input type="TEXT" name="search" /> <input type="SUBMIT" name="submit" value="Search" /> </form> <table border=1> <thead> <tr> <th>ID</th> <th>GAME</th> <th>PLATFORM</th> <th>OWNED</th> </tr> <thead> <tbody> <?php $output = NULL; if(isset($_POST['submit'])) { $mysqli = NEW MySQLi ("localhost","root","","***.**"); $search = $mysqli->real_escape_string($_POST{'search'}); $resultSet = $mysqli->query("SELECT * FROM games WHERE GAME LIKE '$search%'"); if($resultSet->num_rows >0){ while($rows = $resultSet->fetch_assoc()){ $id = $rows['ID']; $gn = $rows['GAME']; $pf = $rows['PLATFORM']; $od = $rows['Owned']; } echo "<tr> <td>"; $id echo " </td> <td>"; $gn echo " </td> <td>"; $pf echo " </td> <td>"; $od </td> </tr>"; } ?> </tbody> </table> </body> </html> </form> </body> </html>
-
mahenda, I don't like frameworks, because straight raw coding can do the same thing usually with less overhead. I the case of forms normal CSS and PHP does a fine job of this. All forms need to be validated and clean up on the server anyway. This the PHP part of my response. Using things like the <input type=""> and the 'required' attribute. Code your form with these and validate on the server.
-
Width on mega menu dropdown - how to achieve that?
NotSunfighter replied to dil_bert's topic in Applications
Never used woocommerce nor WP. But is this some thing like what you wanted: <style> div{display: inline-block;} .navbar-header { display: flex; justify-content: space-between; align-items: center; width:100%; background-color: lightgreen ; } @media screen and (max-width: 600px) { .navbar-header { width:100%;background-color: lightcoral;} } </style> </head> <body> <div class="navbar-header"> <div class="space">Space</div> <div class="container">Header</div> <div class="space">Space</div> </div> </body> </html> -
help with appending data to a text file
NotSunfighter replied to ajetrumpet's topic in PHP Coding Help
What comes to my mind is this: if ($validation == "true") { Notice the double equal signs. This is saying the loop works if the variable $validation is the word TRUE not that $validation is true. About what the same as Barand just posted. BTW - I live in Urbandale, Ia -
Echoing out variable in a table cell doesn't work
NotSunfighter replied to makamo66's topic in PHP Coding Help
You need to post your code -
Or use array_reverse' <?php $input = array("Name", 1, 2, 3, array("red", "green"), 4, "life"); $reversed = array_reverse($input); print_r($input); echo '---<br>'; print_r($reversed); echo '---<br>'; ?>
-
For information on fetch() see https://developers.google.com/web/updates/2015/03/introduction-to-fetch, and https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch. Another source is https://css-tricks.com/using-fetch/. Youtube videos abound, See
-
Nothing is standard. Do you have the brochure in print form already? This would be a big help. Do you have an idea or art work for the main page? That would also be used for the 'about us' and 'contact us' pages. Although the contact us really doesn't need to be a page. IMHO you don't need an eCommerce solution, just a means to process credit cards (Merchant One or Flagship and/or PayPal comes to mind). If you have that and between $1,000.00 to $5,000.00 for the website you're good to go. If you have a brochure and the digitized photos that were used in making the brochure any good programmer could do it.