php - Generate special JS for each modal Bootstrap 3 -
i'm making shop script got problem. made function show items mysql , add modal don't know how add js each modal can buy item without reloading page, on modal. code of item creating:
function create_item($id, $imgid, $title, $desc, $cost, $smscode, $smsnumber) { echo ' <div class="col-sm-12 col-md-3 col-md-offset-1"> <div class="thumbnail"> <span class="pull-right title-itemshop">'. $title .'</span><img class="pull-left"src="id/'. $imgid .'.png"/> <br/><hr class="hr-itemshop"/> <a href="#" class="btn btn-danger form-control" role="button" data-toggle="modal" data-target="#'. $id .'">zobacz więcej »</a> </div> <div id="'. $id .'" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title-item">'. $title .'</h4> </div> <div class="modal-body"> <p>'. $desc .'</p> <p>aby kupić usługę wyślij sms o treści <b>'. $smscode .'</b> na numer <b>'. $smsnumber .'</b> w odpowiedzi otrzymasz kod, który należy podać w formularzu poniżej.</p> <form class="kupno'; echo $id; echo '"> <input id="nick" name="nick" type="text" class="form-control" placeholder="nick osoby"> <input id="kod" name="kod" type="text" class="form-control" placeholder="kod z sms zwrotnego"> <input id="id" name="id" type="hidden" value="'. $id .'"> <input class="btn btn-success" type="submit" value="kup teraz!" id="submit'; echo $id; echo '"> </form> </div> </div> </div> </div> </div> '; }
and how mcbuy.php, it's testing pursposes put save data post file.
<?php $id = strip_tags(trim($_post['id'])); $user = strip_tags(trim($_post['nick'])); $kod = strip_tags(trim($_post['kod'])); $file = 'people.txt'; // open file existing content $current = file_get_contents($file); // append new person file $current .= "$id$user$kod\n"; // write contents file file_put_contents($file, $current); ?>
how can generate each js each item in shop. in mcbuy.php check id of item post data , database
Comments
Post a Comment