Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Sending ID of a PHP row with HTML button

  • 30-03-2015 5:28pm
    #1
    Registered Users, Registered Users 2 Posts: 2,605 ✭✭✭


    I have a site that uses google maps API to add markers to a map and also add details for these markers and save them to a PHP database. These saved markers then can be clicked and they bring up an info window displaying thee specific data for that marker.

    The PHP/HTML that displays the info window is:
    $result = mysqli_query($con, "SELECT * FROM events");

    while($row = mysqli_fetch_array($result))
    {
    echo "<div class='event-details' id='event-details' style='display: none ''>";
    echo "<h3>Event Details</h3>";
    echo "<table class='table'>";
    echo "<tr><th>Event Name: </th><td>" . $row . "</td></tr>";
    echo "<tr><th>Event Date: </th><td>" . $row . "</td></tr>";
    echo "<tr><th>Event Type: </th><td>" . $row . "</td></tr>";
    echo "<tr><th>Event Details: </th><td>" . $row . "</td></tr>";
    echo"</table>";
    echo "<td><a href='details.php?id=".$row."' class='btn btn-warning btn-sm'>View</a></td></div>";
    }


    The JS that displays this info with each marker is:
    var eventList = $("#event-details").clone().show();

    // Display Event details on marker click
    google.maps.event.addListener(event_markers, "click", function () {
    infowindow.setContent(eventList[0]);
    infowindow.open(map, event_markers);
    map.setCenter(marker.getPosition());
    map.setZoom(10);
    });

    Each item in the DB has a unique ID. I want to use this ID variable so that I can send it to other pages so the info can be viewed or that row can be deleted from the DB using its ID.

    As of now, there are 3 different items in the 'events' DB, with ID's being, 6, 7, and 8. Now when I inspect element on each of the markers, they all say that
    <a href="details.php?id=6" class="btn btn-warning btn-sm">View</a>

    But I want them to display their own ID, not just the first one. So when I click the marker that has an ID of 8 in the DB, it should say "details.php?id=8", and NOT "details.php?id=6"
    Tagged:


Advertisement