The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with passing data using Modal
#1
Hi guys...

So wondering if any of you have any experience using modal... So what I am trying to achieve, is to display a grid of data and a button next to each row which when a user clicks will popup a modal and ask for an email address. Then take that email address and submit it to another php file to generate pdf document and email that address. The problem I am having is the variable passed to the modal post command is that last row and not the row of the actual line where the button is...

here is some code:

<table class="table table-hover">
<thead>
<tr>
<th>Id</th>
<th>File#</th>
<th>Subject</th>
<th>Author</th>
<th>Date Created</th>
<th>Last Edited By</th>
<th>Date Last Edited</th>
<th>PDF</th>
</tr>
</thead>
<tbody>
<tr>
<?php foreach ($filenumberResult as $FNR) { ?>
<td><?=$FNR->ID?></td>
<td><a>ID?>"><?=$FNR->FILENUMBER?></a></td>
<td><a>ID?>"><?=$FNR->SUBJECT?></a></td>
<td><?php echouser ($FNR->AUTHOR);?></td>
<td><?=$FNR->DATECREATED?></td>
<td><?php echouser ($FNR->LASTEDITEDBY);?></td>
<td><?=$FNR->DATELASTEDITED?></td>
<td><a>ID?>&fn=<?=$FNR->FILENUMBER?>&dov=D&webkey=<?=$FNR->WEBKEY?>&subject=<?=$FNR->SUBJECT?>"><i class="fa fa-fw fa-file-pdf-o"></i></a> | <a>ID?>&fn=<?=$FNR->FILENUMBER?>&dov=I&webkey=<?=$FNR->WEBKEY?>" target="_blank"><i class="fa fa-fw fa-eye"></i></a> | ID?>"><i class="glyphicon glyphicon-envelope"></i></td>
</tr>
<?php } ?>
</tbody>

<!-- Trigger the modal with a button -->

<!-- Modal -->
<div class="modal fade" id="email-letter" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal" action="emailpdf.php?id=<?=$FNR->ID?>&fn=<?=$FNR->FILENUMBER?>&dov=S&webkey=<?=$FNR->WEBKEY?>&subject=<?=$FNR->SUBJECT?>" method="post">
<div class="modal-header"><h4>Email Letter...</h4></div>
<div class="modal-body">

<div class="form-group">
<?php dump($FNR->ID);?>
<label for="contact-email" class="col-lg-2 control-label">E-mail:</label>
<div class="col-lg-10">
<input type="email" class="form-control" name="contact-email" id="contact-email" placeholder="you@example.com" required><br>
</div>
</div>

</div>
<div class="modal-footer">
<button class="btn btn-success" type="submit">Send Message</button>
<a>Cancel</a>
</div>
</form>
</div>
</div>
</div>

The line:

form class="form-horizontal" action="emailpdf.php?id=<?=$FNR->ID?>&fn=<?=$FNR->FILENUMBER?>&dov=S&webkey=<?=$FNR->WEBKEY?>&subject=<?=$FNR->SUBJECT?>" method="post">

is always getting the last row data and not the row it is assigned to.

I need to figure out how to pass the actual row variables in the action="emailpdf.php?id= protion but am stumped.

I hope im making sense... Any ideas or help cos i have searched and cant seem to figure this out.

Thanks -M
  Reply
#2
ok - i think i may have found a solution using the information from :

https://w3heap.com/questions/2522/pass-p...trap-modal

Going to test now... fingers crossed
  Reply
#3
Good luck Smile
  Reply
#4
Let me know if you don't get it to work, I'm currently working on something similar with modals and can help figure out your problem if needed.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)