Hi guys, bit of a problem here and I'd like to first know if it can be done, and if so, why isn't my code working?
I'm working on a new content management system (CMS) for my website Allaboutthegames.net in particular the article submission page. Now at the moment we have separate forms for if the author is writing a review, a new story or a feature etc. This is because while they all have common fields, reviews and features have an extra field for article_image and a review has an extra field review_score.
I'm not trying to get a single page submission form which will almost operate like a flow chart. The idea is the user submits one piece of information at a time and presses submit, the form then examines the answers to each question before deciding what to do next. I.e. the first field would say "What type of article are you submitting?" If the user chooses review, the form then displays the next part asking them for a review score, if it's not the form then displays the next field.
I've got this working for the first two fields but for some reason any more than 2 fields sends the whole process back to the beginning and it's frutrating me. Have a look at my code to see if you can understand how I'm trying to achieve this and if anyone can work out a flaw with trying it this way then please let me know.
Thanks in advance guys.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?
include ("inc_dbconnect.php");
//part 1 of the form - asks the user to choose what type of article they are writing:
if (isset($ChooseArticleType))
{
$article_type=$_POST['frm_article_type'];
}
else if (!isset($ChooseArticleType))
{
?>
Article type:<br/>
<form method="post" action="<?=$PHP_SELF?>">
<select name="frm_article_type">
<option value="3">News</option>
<option value="1">Review</option>
<option value="2">Preview</option>
<option value="6">Feature</option>
<option value="4">Retro</option>
<option value="5">Guide</option>
</select>
<input name="ChooseArticleType" type="submit" id="ChooseArticleType" value="Submit" />
</form>
<?
exit();
}
//part 2 asks them for the headline of the article they're writing
if (isset($HeadlineSet))
{
$headline=$_POST['frm_headline'];
}
else if (!isset($HeadlineSet))
{
?>
Headline:<br/>
<form method="post" action="<?=$PHP_SELF?>">
<input type="text" name="frm_headline" />
<input name="HeadlineSet" type="submit" id="HeadlineSet" value="Submit" />
</form>
<?
exit();
}
//part 3 asks them to choose the format for the article they're writing
if (isset($ChooseFormat))
{
$format=$_POST['frm_format'];
}
else if (!isset($ChooseFormat))
{
?>
<form method="post" action="<?=$PHP_SELF?>">
<select name="frm_format">
<option value="1">Xbox 360</option>
<option value="2">PS3</option>
<option value="3">DS</option>
<option value="4">PS2</option>
<option value="5">PC</option>
<option value="6">GameCube</option>
</select>
<input name="ChooseFormat" type="submit" id="ChooseFormat" value="Submit" />
</form>
<?
exit();
}
?>
</body>
</html>