html - php script not working in Internet explorer and Firefox -
i have button on webpage allows users add video on page list of favourites. behind button form , php. php code uses session variable retrieve username. information used relevant user id database , store value in variable. using input value form possible retrieve tuple videos database table related video in question , store values of video title , url attributes in variables. code checks if user has added video “favourite”. favourites database entity checked tuples containing both user id , video id. if both contained in single row of database table user has added video , notified of this. otherwise, user id, video id, video title , url inserted favourites database entity , user informed video has been added works fine in chrome or safari nothing in ie or firefox. database updated , message displayed in chrome , safari. i've attached code, please note session has been started in earlier code on webpage. assistance appreciated.
<div id="addfav"> <form action="python.php" method="post"> <input name="add" src="images/add.png" type="image" value="3"> </form> <?php $user=$_session['user']; if ( isset( $_post['add'] ) ) { $vid = $_post["add"]; $sql = "select * `users` username = '$user'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); $uid= $row['user_id']; $sql = "select * `video` video_id = '$vid'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); $url=$row['url']; $title=$row['title']; $check = mysql_query("select * `favourites` uid = '$uid' , vid_id = '$vid'") or die (mysql_error()); $r = mysql_num_rows($check); if ($r>=1) { echo "already added favourites"; echo '<script type="text/javascript">window.alert("already added favourites")</script>'; //'<span style="color: red;" />already added favourites </span>' ; } else { mysql_query("insert `favourites` (`uid`, `vid_id`,`url`,`title`) values ('$uid', '$vid','$url','$title')")or die(mysql_error()); echo "added favourites"; } } ?> </div>
(just debug idea) try change input image hidden element :
<form action="python.php" method="post"> <!-- don't remove this, keep image shown--> <input name="addimg" src="images/add.png" type="image" value="3"> <input type='hidden' name='add' value='3' /> </form>
does works now?
Comments
Post a Comment