if($_POST)
{
if((!$tut_name) || (!$tut_discription) || (!$site_homepage) || (!$tut_page))
{
echo 'Please go back and fill out everything. (You do not have to fill out avatar)';
}
else
{
if((!$avatar_link))
{
require ('config.php');
$result = mysql_query("SELECT * FROM ". $table_prefix ."_categories ORDER BY ID ASC");
while($row = mysql_fetch_array($result))
{
$menu = $_POST['menu'];
$name = $_POST['tut_name'];
$category = $_POST['select'];
$tutorial_description = $_POST['tut_description'];
$site_homepage = $_POST['site_homepage'];
$tut_page = $_POST['tut_page'];
$avatar_link = $row['avatar'];
}
require('config.php');
mysql_query("INSERT INTO ". $table_prefix ."_tutorials (name, category, date, descrip, url2, url, previews, active)
VALUES('$name', '$cateogry', now(), '$tutorial_discription', '$site_homepage', '$tut_page', '$avatar_link', '0')")or die (mysql_error());
echo 'Thank you, your tutorial has been submited. If your tutorial is not on in 7 days it has been declined';
}
else
{
$menu = $_POST['menu'];
$name = $_POST['tut_name'];
$category = $_POST['select'];
$tutorial_description = $_POST['tut_description'];
$site_homepage = $_POST['site_homepage'];
$tut_page = $_POST['tut_page'];
$avatar_link = $_POST['avatar_link'];
require('config.php');
mysql_connect($dbhost, $dbusername, $dbpassword);
mysql_select_db($dbname);
mysql_query("INSERT INTO ". $table_prefix ."_tutorials (name, category, date, descrip, url2, url, previews, active)
VALUES('$name', '$cateogry', now(), '$tutorial_discription', '$site_homepage', '$tut_page', '$avatar_link', '0')")or die (mysql_error());
echo 'Thank you, your tutorial has been submited. If your tutorial is not on in 7 days it has been declined';
}
}
}
else
{
$request_id = $_REQUEST['id'];
$form = '<form name="submit" method="post" action="submit.php?submit=2&id='. $request_id .'">
<p>Tutorial Name:
<input type="text" name="tut_name">
</p>
<p>Tutorial Discription:
<input type="text" name="tut_discription">
</p>
<p>Site Hompage(with http://):
<input type="text" name="site_homepage">
</p>
<p>Tutorial Page (with http://):
<input type="text" name="tut_page">
</p>
<p>Avatar Link (with http://):
<input type="text" name="avatar_link"> (not needed)
</p>
<p>
<input type="submit" value="Submit" name="Submit">
</p>
</form>';
echo $form;
}
Okay at the else part is were it would go if the user did not submit it to there and it has the form on it. Them a bove it there are two parts that look simalar, the top one is if the user does not have an avatar and the botton one is if they do. The bottom one works fine.
Now this is the part I think I am having most of the troubles in:
if((!$avatar_link))
{
require ('config.php');
$result = mysql_query("SELECT * FROM ". $table_prefix ."_categories ORDER BY ID ASC");
while($row = mysql_fetch_array($result))
{
$menu = $_POST['menu'];
$name = $_POST['tut_name'];
$category = $_POST['select'];
$tutorial_description = $_POST['tut_description'];
$site_homepage = $_POST['site_homepage'];
$tut_page = $_POST['tut_page'];
$avatar_link = $row['avatar'];
}
require('config.php');
mysql_query("INSERT INTO ". $table_prefix ."_tutorials (name, category, date, descrip, url2, url, previews, active)
VALUES('$name', '$cateogry', now(), '$tutorial_discription', '$site_homepage', '$tut_page', '$avatar_link', '0')")or die (mysql_error());
echo 'Thank you, your tutorial has been submited. If your tutorial is not on in 7 days it has been declined';
}
It is like it just doesn't what to read the defualt avatar in this part of the script:
$avatar_link = $row['avatar'];
Then because it doesn't want to read it when they submit it it shows nothing there so the picture doesn't want to work.
Now in this part of the script I have two tables the _categories and the _tutorials and what it is suppose to do is take the default link from categories and posts it to the part that has $row['avatar']; there and then it should insert it into the _tutorials categories.
I hope that isn't confusing lol I was trying to tell you as best I could on how I think it should work and whats wrong with it.
dEcade
