vendredi 24 juin 2016

How can i make every <p> tag clickable on a pop-up by using php?

as you can see my code is working with sql. Every email name will be shown on a "pop up". And all of them will have separated p tag. What i am trying to make is when users click this p tag they must access another page. I am new to php and did something wrong . Some help would be great. Thanks. <div id="dialog" title="Following"> <?php $x=0; $arrayName = array(); $sqls = "SELECT * FROM follow WHERE member_email='$email'"; $result = mysqli_query($conn,$sqls); while($row = mysqli_fetch_assoc($result)) { $arrayName[$x] = $row["person_email"]; $x=$x+1; } ?> <?php for($k = 0; $k < $x; $k++) {?> <p id="pop" value="$arrayName[$k]" onclick="popFunc(this.value)"><?php echo $arrayName[$k]; ?></p> </div> ///////////////////////////////////////////////////////////////// function popFunc($element){ $_SESSION['visiter']=$element; document.location.href = 'http://localhost/example/visiter.php'; }

Aucun commentaire:

Enregistrer un commentaire