So, i am making kind of a blog system for my site, and i have 2 tables. One for storing users, their passwords and images (URLs), another for storing all the blog posts, with image_url, author, date and content. The relevant part of my HTML is:
<form action="../scripts/send.php" method="post"><input type="text" name="author" placeholder="Your name" style="width:30%;"/><input type="password" name="pass" placeholder="Password" style="width:30%;"/><br /><input type="text" name="title" placeholder="Post Title" style="width:60%;" /><br /><textarea name="content" rows="20" style="width:60%;"></textarea><br /><button >Post</button></form>
And my PHP code (send.php) is:
<?php
mysql_connect("localhost","kroltan","eclipsepdt123") or die("Can't connect to DB");
mysql_select_db("kroltan_main") or die("Can't select to DB");
$result = mysql_query("SELECT * FROM `users`") or die("Can't fetch data");
if(mysql_num_rows($result) > 0){
while($row = mysql_fetch_assoc($result)){
if ($row['name'] == strtolower($_POST['author'])){
if ($row['pass'] == strtolower($_POST['pass'])){
$name = $_POST['name'];
$comm = $_POST['comment'];
$result = mysql_query("INSERT INTO blog_posts (img_url, author, title, content) VALUES(".$row['img'].", ".$_POST['author'].", ".$_POST['title'].", ".$_POST['content'].")") or die("Can't send data");
header("Location: /?/=Talk");
}
}
}
}
?>
When i try to create a new post on the site, it does not work. I am not even redirected to the page