I can't seem to be able to take a text input field (LeadHomeHead) and store it in a hidden field (NewHomeHead) and when the PHP_SELF form has been submitted to pass and use the hidden field in other forms. Here's the abbridged code:
<form action="<?php echo $PHP_SELF ?>" method="post">
<?php
if (!$ItemType)
{
?>
<table align="center" border="0" class="backend">
<tr><td align="center"><b>Insert News</b></td></tr>
<tr><td align="center">Would you like to enter a lead or a secondary news item?</td></tr>
<tr><td align="center"><input type="radio" name="item" value="lead">Lead
<input type="radio" name="item" value="secondary">Secondary</td></tr>
<tr><td align="center"><input type="submit" name="ItemType" value="Submit"></td></tr>
</table>
<?php
}
if ($ItemType)
{
$item=$HTTP_POST_VARS['item'];
if ($item=='lead')
{
if (!$LeadStorySubmit)
{
?>
<table align="center" border="0" class="backend">
<tr><td align="center"><b>Insert Lead News Item</b></td></tr>
<tr><td align="center">Please enter the following information below:</td></tr>
</table><br /><br />
<table border="0" align="center" class="backend">
<tr><td colspan="2" align="center"><b>Lead Story Blurb</b></td></tr>
<tr><td>Abbridged Headline:</td>
<td><textarea name="LeadHomeHead" rows="1" cols="50" maxlength="60"></textarea>
</td></tr>
<tr><td>Abbridged Body:</td>
<td><textarea name="LeadHomeBody" rows="3" cols="50" maxlength="200"></textarea>
</td></tr>
<tr><td>Full Headline:</td>
<td><textarea name="LeadHeadline" rows="2" cols="50"></textarea></td></tr>
<tr><td>Full Body:</td>
<td><textarea name="LeadBody" rows="5" cols="50"></textarea></td></tr>
<tr><td colspan="2" align="center">
<input type="hidden" name="ItemType" value="Submit">
<input type="hidden" name="item" value="lead">
<input type="hidden" name="NewHomeHead" value="<?php $HTTP_POST_VARS['LeadHomeHead'] ?>">
<input type="submit" name="LeadStorySubmit" value="Submit">
</td></tr></table>
<?php
}
if ($LeadStorySubmit)
{
if (strlen($HTTP_POST_VARS['LeadHomeHead']) > 60)
{
echo $HTTP_POST_VARS['LeadHomeHead'].'Please provide an abbridged headline with less than 60 characters.<br />
<a href="insertnews.php">Go back</a>';
exit;
}
elseif (strlen($HTTP_POST_VARS['LeadHomeBody']) < 140)
{
echo 'Please provide an abbridged body with more than 140 characters.<br />
<a href="insertnews.php">Go back</a>';
exit;
}
elseif (strlen($HTTP_POST_VARS['LeadHomeBody']) > 200)
{
echo 'Please provide an abbridged body with less than 200 characters.<br />
<a href="insertnews.php">Go back</a>';
exit;
}
elseif (strlen($HTTP_POST_VARS['LeadHomeHome'] <= 60) && strlen($HTTP_POST_VARS['LeadHomeBody']) >= 140 && strlen($HTTP_POST_VARS['LeadHomeBody']) <= 200)
{
@ $db = mysql_pconnect('localhost', 'user', 'pass');
if (!$db)
{
echo 'Could not connect to the database. Try again later.';
exit;
}
$select=mysql_select_db("DB");
if (!$select)
{
print "ERROR: " . mysql_error() . "\n";
}
$LeadInsert = mysql_query ("INSERT INTO news (HomeHead, HomeBody, Headline, Body, DatePosted)VALUES ('$HTTP_POST_VARS[LeadHomeHead]', '$HTTP_POST_VARS[LeadHomeBody]', '$HTTP_POST_VARS[LeadHeadline]','$HTTP_POST_VARS[LeadBody]', now())");
if ($LeadInsert)
{
?>
</form>
<?php
echo $HTTP_POST_VARS['NewHomeHead'];
exit;
?>
<form action="leadprocess.php" method="post">
include("leadprocess.php");
?>
</form>
<?php
}
else
{
echo '</form>Your record has not been entered into the database.<br /><a href="insertnews.php">Go back</a>';
exit;
}
}
}
}