TeddyKiller Posted April 5, 2010 Share Posted April 5, 2010 Here is the php for the form. echo '<form action="" method="post"> <input type="hidden" name="id" value="'.$rw['id'].'" /> <input type="submit" name="accept" value="Accept!" /> <input style="margin-left:30px;" type="submit" name="decline" value="Decline!" /></form>'; Here is what I'm using to validate the form. if(isset($_POST['accept'])){ if(isset($_POST['id'])){ $id = $_POST['id']; $query = mysql_query("UPDATE `friend_requests` SET `status`='2' WHERE `request_to`='$user->id' AND `request_by`='$id'"); $query = mysql_query("INSERT INTO `friends` (user_id, friend_id) VALUES ('$user->id', '$id'"); $query = mysql_query("INSERT INTO `friends` (user_id, friend_id) VALUES ('$id', '$user->id'"); } } if(isset($_POST['decline'])){ if(isset($_POST['id'])){ $id = $_POST['id']; $query = mysql_query("UPDATE `friend_requests` SET `status`='1' WHERE `request_to`='$user->id' AND `request_by`='$id'"); } } It's not really validation.. but yeah. I've checked the queries for errors and it doesn't do them. I assume it's not knowing what the $_POST's are. Though there is no reason for it to not know what it is? Whats the problem? Thanks Link to comment https://forums.phpfreaks.com/topic/197582-whats-wrong-the-form-seems-to-not-like-the-validation/ Share on other sites More sharing options...
andrewgauger Posted April 5, 2010 Share Posted April 5, 2010 If you suspect the post do a print_r($_POST) to rule that out first. Link to comment https://forums.phpfreaks.com/topic/197582-whats-wrong-the-form-seems-to-not-like-the-validation/#findComment-1036948 Share on other sites More sharing options...
TeddyKiller Posted April 5, 2010 Author Share Posted April 5, 2010 I'm not sure why the first query never worked.. suddenly it started to work. As for.. "VALUES ('$id', '$user->id'");" I'm missing an ) on the end. Solved. Link to comment https://forums.phpfreaks.com/topic/197582-whats-wrong-the-form-seems-to-not-like-the-validation/#findComment-1036949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.