Jump to content

Recommended Posts

code for the confirm button

<?php

            $sql = "SELECT * FROM studentrequest";

            $result = mysqli_query($conn,$sql);

            if($result){

              while($row = mysqli_fetch_assoc($result)){

                $srequestid = $row['studentrequestid'];

                $studentid = $row['studentID'];

                $studentname = $row['studentName'];

                $roomnumber = $row['roomNumber'];

                $instructor = $row['instructor'];

                $dateuse = $row['dateUsed'];

                $ts = $row['timeStart'];

                $te = $row['timeEnd'];

                echo '      

                <tr>

                <th scope="row">'.$srequestid.'</th>

                <td>'.$studentid.'</td>

                <td>'.$studentname.'</td>

                <td>'.$roomnumber.'</td>

                <td>'.$instructor.'</td>

                <td>'.$dateuse.'</td>

                <td>'.$ts.'</td>

                <td>'.$te.'</td>

                <td>

               

                <button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#

               

                ">Confirm</a></button>

                <div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-labelledby="comfirms" aria-hidden="true">

                <div class="modal-dialog" role="document">

                  <div class="modal-content">

                    <div class="modal-header">

                      <h5 class="modal-title" id="confirms">Alert!</h5>

                      <button type="button" class="close" data-dismiss="modal" aria-label="Close">

                        <span aria-hidden="true">&times;</span>

                      </button>

                    </div>

                    <div class="modal-body">

                      Are you sure you want to confirm this?

                      <br><br>

                      <h3>Details</h3>

                     

                        Name: '.$studentname.'

                        <br>

                        Room number: '.$roomnumber.'

                        <br>

                        Date use: '.$dateuse.'

                        <br>

                        Time start: '.$ts.'

                        <br>

                        Time end: '.$te.'

                        <br>

                    </div>

Link to comment
https://forums.phpfreaks.com/topic/315463-data-modal-pop-up/#findComment-1601970
Share on other sites

6 minutes ago, wsrta said:

id="confirm"

ids must be unique throughout the html document. since each section has the same id, the popup code always displays the first section.

you need to use a different selector in the javascript, either to operate on the current element, find the nearest element, or use unique and valid ids in the markup. posting all the code needed to reproduce the problem would allow someone here to help arrive at the simplest result.

Link to comment
https://forums.phpfreaks.com/topic/315463-data-modal-pop-up/#findComment-1601971
Share on other sites

modal?

I see a sample of some output and a long stretch of code that doesn't do anything other than produce some html table output.  Not well done either  - a row with one heading element combined with data items is not proper syntax and I actually wonder what it would produce.

And I see a button tag.  What does that button actually do?  It's not a submit and it doesn't trigger any JS so I'm lost.  And if it were a submit, there is no form to tell it where to go.

Link to comment
https://forums.phpfreaks.com/topic/315463-data-modal-pop-up/#findComment-1601972
Share on other sites

Did some clean up of your code to get a better picture.  And still don't see it

$sql = "SELECT * FROM studentrequest";	// DON'T USE *
$result = mysqli_query($conn,$sql);
if($result)
{
		while($row = mysqli_fetch_assoc($result))
		{
			$srequestid = $row['studentrequestid'];
			$studentid = $row['studentID'];
			$studentname = $row['studentName'];
			$roomnumber = $row['roomNumber'];
			$instructor = $row['instructor'];
			$dateuse = $row['dateUsed'];
			$ts = $row['timeStart'];
			$te = $row['timeEnd'];
			echo "<tr>
				<th scope='row'>$srequestid</th>
				<td>$studentid</td>
				<td>$studentname</td>
				<td>$roomnumber</td>
				<td>'.$instructor.'</td>
				<td>'.$dateuse.'</td>
				<td>'.$ts.'</td>
				<td>'.$te.'</td>
				<td>
				<button type='button' class='btn btn-outline-success' data-toggle='modal' data-target='#'>
				Confirm
				</a>
				</button>
				<div class='modal fade' id='confirm' tabindex='-1' role='dialog' aria-labelledby='comfirms' aria-hidden='true'>
				<div class='modal-dialog' role='document'>
				<div class='modal-content'>
				<div class='modal-header'>
				<h5 class='modal-title' id='confirms'>Alert!</h5>
				<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
				<span aria-hidden='true'>&times;</span>
				</button>
				</div>
				<div class='modal-body'>
				Are you sure you want to confirm this?
				<br><br>
				<h3>Details</h3>
				Name: $studentname
				<br>
				Room number: $roomnumber
				<br>
				Date use: $dateuse
				<br>
				Time start: $ts
				<br>
				Time end: $te
				<br>
				</div>

You need:

                NEED A CLOSING BRACE FOR YOUR ROW PROCESSING
                NEED SOME CLOSING DIV TAGS
                NEED AN ENDING ROW TAG and an ending quote for all the html you have echoed.
                NEED TO MOVE THAT TH TAG TO ITS OWN ROW
                NEED TO CHANGE THE BUTTON TAG TO EITHER USE SOME JS CODE OR TO DO A SUBMIT AND IF
                IT'S TO BE A SUBMIT YOU NEED A FORM CREATED.
 

Link to comment
https://forums.phpfreaks.com/topic/315463-data-modal-pop-up/#findComment-1601973
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.