dadamssg Posted July 24, 2009 Share Posted July 24, 2009 Im displaying personal messages with X's next to them. I'm making these X's links to an javascript confirm box to make sure they want to delete. heres my while loop that defines functions for each message and outputs who's it from, the subject, etc. It works except for the very last message. So if i have 5 messages, the first four will give me the alert box when i click the X but when i click the 5th message X nothing happens. I have no clue why <?php while ($row = mysqli_fetch_assoc($result)) { // echo data if($row['subject'] =="") { $id = "*No Subject*"; } else{ echo "<script type='text/javascript'> function show_confiirm{$row['messageid']}() { var r=confirm('Really delete?'); if (r==true) { window.location = 'deletemessage.php?ms={$row['messageid']}' } else { } } </script>"; $id = stripslashes($row['subject']); } $time = date('M j, Y g:i a',strtotime($row['time'])); if($row['status']=="0") {$status ="<b>New</b>"; }else{ $status =""; } echo "<div id='mwrap'><div id='mwidth'><div id='floatl'>{$status}</div><div id='floatr'><a href= profile.php?uu={$row['sentby']} class='profile'>{$row['sentby']}</a><br><div class='user'>{$time}</div></div></div>"; echo "<div id='twidth'><a href = showmessage.php?ms={$row['messageid']} class='subject'>{$id}</a></div>"; echo "<div id='delete'><a href ='' onclick='show_confiirm{$row['messageid']}()' class='delete'>X</a></div></div>"; } any ideas of whats happening? i look at the page source from the browser and it looks fine Link to comment https://forums.phpfreaks.com/topic/167208-wierd-phpjavascript-happening/ Share on other sites More sharing options...
dadamssg Posted July 24, 2009 Author Share Posted July 24, 2009 ok, the last one doesn't output the javascript function, while all the ones before DO...WEIRD. I looked at the page source closer. Link to comment https://forums.phpfreaks.com/topic/167208-wierd-phpjavascript-happening/#findComment-881621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.