Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. phppup

    JS for radio button TEXT content

    Made several adjustments but don't seem to be hitting the mark. <form name="form"> <b>What do you like best?</b><br> <input type="radio" name="group1" id="male" value="mommy" checked> <label for="male">i want to see this: mommy hands</label><br> <input type="radio" name="group1" id="female" value="toys"> <label for="female">i want to see this: toys and talking</label><br> <input type="radio" name="group1" id="other" value="monkeys"> <label for="other">i want to see this: monkeys and tigers</label><br> <input type="Button" onClick="whichButton()" value="What did you check?"> </form> <script language="JavaScript" type="text/javascript"> function whichButton() { var group1Checked for (var i=0; i<document.form.group1.length; i++) { if (document.form.group1[i].checked) { //group1Checked = document.form.group1[i].value; //This worked, but provides VALUE element NOT the TEXT that is desired // group1Checked = document.form.group1[i].textContent(); group1Checked = document.querySelector("label[for='" + this.id + "']") } } if(group1Checked){ //if(group1Check) is just saying, "if group1Checked does not equal null" alert("I like " + this.id + " best.") } else{ alert("You did not make a selection.") } } </script> Can anyone get this to run so that it delivers the label TEXT in the alert? Currently, I get "You did not make a selection" even though choices are picked.
  3. Today
  4. I knew nothing about this and found the answer in 2 seconds using this web tool called google. https://help.github.com/articles/what-is-my-disk-quota/ https://help.github.com/articles/about-storage-and-bandwidth-usage/
  5. ginerjm

    Database not connecting again!!!

    When developing I find it much much easier to see the errors on my screen as I run/test my script instead of having to go download an error log file and viewing that. Try it. But be sure to turn if off once you have completed your project.
  6. valrikJay

    hire a programmer

    https://www.facebook.com/jason.chadwick.92798 ot valrikstudios@gmail.com
  7. mstdmstdd

    How to fix error setting SSL with certbot using?

    I made some more review and found next : IP of my server is 138.68.107.4 and under ssh I enter the console of OS as ssh root@138.68.107.4 But in my /etc/hosts file I had next lines pointing to some other hosts on this server: # 127.0.0.1 localhost 127.0.0.1 localhost.localdomain localhost 138.68.107.4 box.example.com box # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 138.68.107.4 votes.nilov-sergey-demo-apps.tk 138.68.107.5 products-catalog.nilov-sergey-demo-apps.tk 138.68.107.6 csvp.nilov-sergey-demo-apps.tk ... I modified 3 last lines as : 138.68.107.4 votes.nilov-sergey-demo-apps.tk 138.68.107.4 products-catalog.nilov-sergey-demo-apps.tk 138.68.107.4 csvp.nilov-sergey-demo-apps.tk But I still not sure is that is valid value, as I have next error again: # sudo certbot --apache -d products-catalog.nilov-sergey-demo-apps.tk -d www.products-catalog.nilov-sergey-demo-apps.tk Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for products-catalog.nilov-sergey-demo-apps.tk http-01 challenge for www.products-catalog.nilov-sergey-demo-apps.tk Waiting for verification... Cleaning up challenges Failed authorization procedure. www.products-catalog.nilov-sergey-demo-apps.tk (http-01): urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up A for www.products-catalog.nilov-sergey-demo-apps.tk IMPORTANT NOTES: - The following errors were reported by the server: Domain: www.products-catalog.nilov-sergey-demo-apps.tk Type: None Detail: DNS problem: NXDOMAIN looking up A for www.products-catalog.nilov-sergey-demo-apps.tk can reason of this error be in wrong IP in /etc/hosts or some other issue ?
  8. Barand

    Delete a MySQL row from a drop-down HTML menu

    See handling post variables
  9. KevBurgess

    Delete a MySQL row from a drop-down HTML menu

    Hi Barand, many thanks for the tip, it certainly helped. When I click on the "Submit" button though the DELETE statement isn't carried out and the contents of the drop-down list are simply reset. It seems to me as if the variable $anr is not being carried over into the DML statement. Here the altered code: <!DOCTYPE HTML> <?php $pdo = new PDO ('mysql:dbname=bestelldatenbank;host=localhost;charset=utf8', 'root', ''); $anr = ""; if ($_SERVER['REQUEST_METHOD']=='POST') { artLoeschen($anr); } ?> <html lang="de"> <head> <meta charset="utf-8" /> <title>E3_Artikel_Löschen</title> </head> <body> <form method = "POST"> <div> <p> <label for="artikel">Artikel: </label> <select id="artikel" name="artikel"> <?php $sqlSelect = "SELECT anr, name FROM artikel ORDER BY anr ASC"; foreach ($pdo->query($sqlSelect) as $row) { echo "<option value=$row[0]>$row[0] | $row[1]</option>\n"; $anr = $row[0]; } ?> </select> <input type = "submit" value = "Datensatz löschen" /> </p> </div> <?php function artLoeschen($anr) { try { $pdo; } catch (PDOException $error){ die ($error->getMessage()); } if(!isset($_POST[$anr])) { echo "<p><b>Artikel nummer nicht gesetzt</b></p>"; } else { $sqlDelete = $pdo->query("DELETE FROM artikel WHERE anr = :anr"); if ($stmt = $pdo->prepare($sqlDelete)) { $stmt->bindParam(':anr', $anr); $stmt->execute(); echo "<h2><b>Artikel gelöscht!</b></h2>"; } } $pdo = null; } ?> </form> </body> </html> Just for my personal understanding: What actually happens when I click on "Submit"? Is the entire contents of the .php script run or just the dynamic component, in this case the DML statement? Thanks for your help..... Regards, Kev
  10. Sambo258

    Ajax Live Search

    Hi Requinix, The Excerpt is the date and time here is the full script for it if(!function_exists('avia_ajax_search')) { //now hook into wordpress ajax function to catch any ajax requests add_action( 'wp_ajax_avia_ajax_search', 'avia_ajax_search' ); add_action( 'wp_ajax_nopriv_avia_ajax_search', 'avia_ajax_search' ); function avia_ajax_search() { global $avia_config; unset($_REQUEST['action']); if(empty($_REQUEST['s'])) $_REQUEST['s'] = array_shift(array_values($_REQUEST)); if(empty($_REQUEST['s'])) die(); $defaults = array('numberposts' => 5, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false, 'results_hide_fields' => ''); $_REQUEST['s'] = apply_filters( 'get_search_query', $_REQUEST['s']); $search_parameters = array_merge($defaults, $_REQUEST); if ( $search_parameters['results_hide_fields'] !== '' ) { $search_parameters['results_hide_fields'] = explode(',', $_REQUEST['results_hide_fields']); } else { $search_parameters['results_hide_fields'] = array(); } $search_query = apply_filters('avf_ajax_search_query', http_build_query($search_parameters)); $query_function = apply_filters('avf_ajax_search_function', 'get_posts', $search_query, $search_parameters, $defaults); $posts = (($query_function == 'get_posts') || !function_exists($query_function)) ? get_posts($search_query) : $query_function($search_query, $search_parameters, $defaults); $search_messages = array( 'no_criteria_matched' => __("Sorry, no posts matched your criteria", 'avia_framework'), 'another_search_term' => __("Please try another search term", 'avia_framework'), 'time_format' => get_option('date_format'), 'all_results_query' => http_build_query($_REQUEST), 'all_results_link' => home_url('?' . http_build_query($_REQUEST)), 'view_all_results' => __('View all results','avia_framework') ); $search_messages = apply_filters('avf_ajax_search_messages', $search_messages, $search_query); if(empty($posts)) { $output = "<span class='av_ajax_search_entry ajax_not_found'>"; $output .= "<span class='av_ajax_search_image ".av_icon_string('info')."'>"; $output .= "</span>"; $output .= "<span class='av_ajax_search_content'>"; $output .= " <span class='av_ajax_search_title'>"; $output .= $search_messages['no_criteria_matched']; $output .= " </span>"; $output .= " <span class='ajax_search_excerpt'>"; $output .= $search_messages['another_search_term']; $output .= " </span>"; $output .= "</span>"; $output .= "</span>"; echo $output; die(); } //if we got posts resort them by post type $output = ""; $sorted = array(); $post_type_obj = array(); foreach($posts as $post) { $sorted[$post->post_type][] = $post; if(empty($post_type_obj[$post->post_type])) { $post_type_obj[$post->post_type] = get_post_type_object($post->post_type); } } //now we got everything we need to preapre the output foreach($sorted as $key => $post_type) { // check if post titles are in the hidden fields list if ( ! in_array('post_titles', $search_parameters['results_hide_fields'] ) ) { if(isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_ajax_search_label_names', $post_type_obj[$key]->labels->name); $output .= "<h4>".$label."</h4>"; } else { $output .= "<hr />"; } } foreach($post_type as $post) { $image = ""; $extra_class = ""; // check if image is in the hidden fields list if (!in_array('image', $search_parameters['results_hide_fields'])) { $image = get_the_post_thumbnail($post->ID, 'thumbnail'); $extra_class = $image ? "with_image" : ""; $post_type = $image ? "" : get_post_format($post->ID) != "" ? get_post_format($post->ID) : "standard"; $iconfont = $image ? "" : av_icon_string($post_type); } $excerpt = ""; // check if post meta fields are in the hidden fields list if ( ! in_array('meta', $search_parameters['results_hide_fields'] ) ) { if(!empty($post->post_excerpt)) { $excerpt = apply_filters( 'avf_ajax_search_excerpt', avia_backend_truncate($post->post_excerpt,70," ","...", true, '', true) ); } else { $excerpt = apply_filters( 'avf_ajax_search_no_excerpt', get_the_time( $search_messages['time_format'], $post->ID ), $post ); } } $link = apply_filters('av_custom_url', get_permalink($post->ID), $post); $output .= "<a class ='av_ajax_search_entry {$extra_class}' href='".$link."'>"; if ($image !== "" || $iconfont) { $output .= "<span class='av_ajax_search_image' {$iconfont}>"; $output .= $image; $output .= "</span>"; } $output .= "<span class='av_ajax_search_content'>"; $output .= " <span class='av_ajax_search_title'>"; $output .= " <span class='wpcr3_rating_style1_average'>"; $output .= get_the_title($post->ID); $output .= " </span>"; if ($excerpt !== '') { $output .= " <span class='ajax_search_excerpt'>"; $output .= $excerpt; $output .= " </span>"; } $output .= "</span>"; $output .= "</a>"; } } $output .= "<a class='av_ajax_search_entry av_ajax_search_entry_view_all' href='".$search_messages['all_results_link']."'>".$search_messages['view_all_results']."</a>"; echo $output; die(); } } This is the entire script
  11. Can I use GitHub GitLab as free unlimited cloud storage? is this possible!
  12. Barand

    Delete a MySQL row from a drop-down HTML menu

    At the top of the script, before the HTML. If your intent is change data, such as a delete, insert, update, use form method POST. Use GET when you want to get data for display. Check if data was posted. If it was, process the posted data. if ($_SERVER['REQUEST_METHOD']=='POST') { // process the $_POST data } <html> .....
  13. KevBurgess

    Delete a MySQL row from a drop-down HTML menu

    You are of course right and I forgot to include the line in my code. I had tried to include this call in several places to test the results, all unsuccessful: <?php artLoeschen($anr); ?> Unfortunately I was only guessing where the line should go and that is what is irritating me because nothing I tried seemed to work. Where on earth should this call go in order to submit the form after selecting the appropriate item so the item is deleted? Regards, Kev
  14. requinix

    Url Accepted with space

    Okay, fine, you can 404 it instead of redirecting. Same difference.
  15. Yesterday
  16. dev198

    Url Accepted with space

    If it is happening than one of the url should be go on 404 or redirect on the page, but both url is working separately and google search console consider that these are two url
  17. requinix

    Delete a MySQL row from a drop-down HTML menu

    You may have that function but you don't have anything that calls it. Functions don't run automatically. You need to add some code that decides whether it should call the function, and if so with what argument.
  18. ok i figured it out, my INSERT query was in the LOOP!!!! so it ran the insert 3 times, hence the data being inserted for each submit. problem is now solved
  19. Hi all, I am currently learning PHP and have the homework to produce a function that can delete a row in a MySQL database table by clicking on an item in a drop-down menu in a web page. The code I have produced up until now is this: <!DOCTYPE HTML> <html lang="de"> <head> <meta charset="utf-8" /> <title>E3_Artikel_Löschen</title> </head> <body> <form method = "GET"> <?php $anr=""; try { $pdo = new PDO ('mysql:dbname=bestelldatenbank;host=localhost;charset=utf8', 'root', ''); } catch (PDOException $error){ die ($error->getMessage()); } ?> <div> <p> <label for="artikel">Artikel: </label> <select id="artikel" name="artikel"> <?php $sqlSelect = "SELECT anr, name FROM artikel ORDER BY anr ASC"; foreach ($pdo->query($sqlSelect) as $row) { echo "<option value=$row[0]>$row[0] | $row[1]</option>\n"; $anr = $row[0]; } ?> </select> <input type = "submit" value = "Delete row" /> </p> </div> <?php function artLoeschen($anr) { echo "Function called $anr"; if(isset($_GET[$anr])) { $anr = $_GET[$anr]; $sqlDelete = $pdo->query("DELETE FROM artikel WHERE anr = :anr"); if ($stmt = $pdo->prepare($sqlDelete)) { $stmt->bindParam(':anr', $anr); $stmt->execute(); } echo "<h2><b>Artikel gelöscht!</b></h2>"; } } ?> </form> </body> </html> So, I have observed the following when I run the script in a browser: 1. The HTML works as expected and I get a drop-down list with the article number and description of each item in the affected table. 2. I can click on an item in the list and it populates the top item in the drop-down list. 3. When I click delete row, the selected item is not deleted. 4. There are no error messages returned but the function is not executed (at least not as I would like to expect). I have obviously missed something or made a mistake in my code. I would be very grateful for any help...this is driving me mad! :) Regards, Kevin
  20. requinix

    Url Accepted with space

    Apparently you have something that converts hyphens to spaces. You might as well accept it. But you can redirect: figure out the correct URL slug, and if it doesn't match the one provided then send them there.
  21. dev198

    Url Accepted with space

    Yes, this is the main issue, so how can i found the issue, because both urls are working fine, how can i find the main issue
  22. benanamen

    Url Accepted with space

    If you copy paste the URL from the browser you will see that the space is transformed to %20. You should not have the spaces in the first place. Spaces are considered unsafe according to the RFC.
  23. you are correct, it will keep getting the id from the query till the loop finishes. yeah i need the form to send the ID of each table so i can collect a list of who is attending the event, im storing this in another table so i can correlate the data between the 2x tabels. but if the user clicks attend on the top table i dont want the data being sent for the 2nd OR 3rd table. here is a visual representation of what i wanted to achieve:
  24. dev198

    Url Accepted with space

    Hello Experts, I am facing an issue that my site's some urls are working fine containing space, So can you help me what is the reason behind it, and how can i fix it. https://asapcashhomebuyers.com/new-york/ https://asapcashhomebuyers.com/new york/ Thanks
  25. I'll try. $event_id is being assigned in the loop. Right. So it gets set to the first value, then the second, and it gets set for every row that came back from the query. All that happens inside the loop. When that finishes and there are no more rows, what will $event_id be? And does that value have any relation whatsoever to the form that the user submitted?
  26. on the contrary i am answering the question..... unless you're attempting to be cryptic then i have no clue but as i said above, its looping the results and pulls the id from events table, and i assigned it to the $event_id variable, it then adds that into the eventssignup table, which is exactly as i want it to do.. but i only want the form to process the single table insert, not for all the looped results.
  27. requinix

    help with charge formula

    What I've been trying to get you to do this whole time is learn some PHP. If you're working with the code then you need to know how to do it. Asking people on the internet to do the work for you is not a good idea. Don't know how to code it? That's fine. No problem. What could be a problem is you not being willing to invest some time into changing your situation so that you do know how to code it. I linked you a function. If you pass two arguments, such as the default price and the uploader's price, then it will give you back the larger value.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×

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.