Nope, no good. It reloads my page instead of being re-located to my second page. What a drag!!! :mad:
Here is my modified code:
<?PHP
session_register();
header("Cache-control: private");
function check()
{
if ($POST['process'] == 1)
{
$sentarray=array();
$tocheck=explode(',',$POST['required']);
$error[0]="Errors:";
foreach ($tocheck as $t)
{
if(!array_key_exists($t,$_POST))
{$error[]=$t;}
}
foreach (array_keys($_POST) as $p)
{
if(!preg_match('/initvalue/',$p) and !preg_match('/required/',$p))
{
$sentarray[$p]=$_POST[$p]==$_POST[$p.'initvalue']?'':$_POST[$p];
}
foreach ($tocheck as $c)
{
if ($p==$c and $sentarray[$p]=='')
{
$error[]=$_POST[$p.'initvalue'];
}
}
}
return $error[1]==''?$sentarray:$error;
}
}
function add($f)
{
global $errorindicator,$errorclass,$Javascript;
$tocheck=explode(',',','.$_POST['required']);
preg_match('/id="(.*?)"/i',$f,$i);
preg_match('/name="(.*?)"/i',$f,$n);
preg_match('/type="(.*?)"/i',$f,$t);
preg_match('/value="(.*?)"/i',$f,$iv);
$n=$n[1];$iv=$iv[1];$i=str_replace('_',' ',$i[1]);
if(preg_match('/<textarea/',$f))
{
$v=$_POST[$n]==''?$i:$_POST[$n];
$f=preg_replace('/<textarea(.*?)>(.*?)<\/textarea>/',
'<textarea\\1>'.stripslashes(htmlentities($v)).'</textarea>',$f);
if($Javascript){$f=preg_replace('/<textarea/','<textarea onfocus="this.value=this.value==\''.$i.'\'?\'\':this.value"',$f);}
}
if(preg_match('/<select/',$f))
{
preg_match('/<select.*?>/',$f,$st);
preg_match_all('/<option value="(.*?)">(.*?)<\/option>/',$f,$allopt);
foreach ($allopt[0] as $k=>$a){
if($_POST[$n]==$allopt[1][$k] || ($_POST[$n]=='' && $k==0)){
$preg='/<option value="';
$preg.=$allopt[1][$k].'">'.$allopt[2][$k].'<\/option>/si';
$rep='<option selected="selected" value="';
$rep.=$allopt[1][$k].'">'.$allopt[2][$k].'</option>';
$f=preg_replace($preg,$rep,$f);
}
}
}else{
switch ($t[1]){
case 'text':
$v=$_POST[$n]==''?'value="'.$i.'"':'value="'.stripslashes(htmlentities($_POST[$n])).'"';
$f=preg_replace('/<input/','<input '.$v,$f);
if($Javascript){$f=preg_replace('/<input/','<input onfocus="this.value=this.value==\''.$i.'\'?\'\':this.value"',$f);}
break;
case 'checkbox':
$v=$_POST[$n]=='on'?' checked="checked"':'';
$f=preg_replace('/<input/','<input'.$v,$f);
break;
case 'radio':
$f=$_POST[$n]==''?$f:preg_replace('/checked.*?\s/','',$f);
//$f=preg_replace('/checked.*?\s/','',$f);
$v=$_POST[$n]==$iv?' checked="checked"':'';
$f=preg_replace('/<input/','<input'.$v,$f);
break;
}
}
$f.='<input type="hidden" name="'.$n.'initvalue" value="'.$i.'" />';
if (array_search($n,$tocheck) and ($_POST[$n]=='' or $_POST[$n]==$i)){
if($errorindicator!=''){$f=$errorindicator.$f;}
if($errorclass!=''){$f=preg_replace('/name=/i','class="'.$errorclass.'" name=',$f);}
}
return $f;
}
function DisplayPage2()
{
$SESSION['POST_VARS'] = base64_encode(serialize($POST));
session_write_close();
header("location:abstract_page_2.php");
}
$errorindicator='<img src="alert.gif" width="20" height="20" alt="Alert" title="Indicator for missing form element" border="0" />';
$errorclass="error";
$Javascript=false;
$results=check();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link rel="StyleSheet" href="styles.css" type="text/css">
</head>
<body>
<table width="50%" border="0" cellspacing="1" cellpadding="0" bgcolor="#eb6093">
<tr>
<td>
<table width="50%" border="0" cellspacing="0" cellpadding="5" bgcolor="white">
<tr>
<td><br/>
<form action="abstract_page_1v3.php" method="post">
<div align="left">
<img src="images/i_abstract_information.gif" alt="" height="30" width="700" border="0"/><?PHP if($results[0]=='Errors:') {?><br/>
<h2 class="errorhead">There has been an error:</h2>
<p>You forgot to enter the following field(s)</p>
<?PHP
foreach ($results as $i=>$e)
{
if ($i>0)
{
echo "<li>$e</li>";
}
}
} else
if ($results['Title']!='')
{
DisplayPage2();
}?>
<p><input type="hidden" name="required" value="Title,Topic" /><input type="hidden" name="process" value="1" />
<table border="0" cellspacing="0" cellpadding="5" bgcolor="white">
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td width="25%"><font color="red" face="Verdana">*</font><font face="Verdana"><b>Title:</b></font></td>
<td><?=add('<input type="text" name="Title" id="Title" />')?></td>
</tr>
<tr>
<td width="25%"></td>
<td></td>
</tr>
<tr>
<td width="25%"><font color="red" face="Verdana">*</font><font face="Verdana"><b>Topic:</b></font></td>
<td><?=add('
<select id="Topic" name="Topic" onchange="Enable_Other_Topic_Field(this); ">
<option value="">Select A Topic</option>
<option value="Angiogenesis">Angiogenesis</option>
<option value="Clinical Therapeutics">Clinical Therapeutics</option>
<option value="Genetics and Imaging">Genetics and Imaging</option>
<option value="Metastasis and Metastatic Disease">Metastasis and Metastatic Disease</option>
<option value="Pathology and Molecular Profiling">Pathology and Molecular Profiling</option>
<option value="Receptors and Hormones">Receptors and Hormones</option>
<option value="Signal Transduction">Signal Transduction</option>
<option value="Tumor Microenvironment and Cancer Stem Cells">Tumor Microenvironment and Cancer Stem Cells</option>
<option value="Other topic">Other</option>
</select>
')?></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td width="25%"><font face="Verdana"><b>Other topic<br/>
(please specify):</b></font></td>
<td><?=add('<input type="text" name="Other_Topic" id="" />')?></td>
</tr>
<tr>
<td width="25%"></td>
<td></td>
</tr>
<tr>
<td width="25%"><font color="red" face="Verdana">*</font><font face="Verdana"><b>Type of presentation:</b></font></td>
<td>
<table width="30%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?=add('<input type="radio" name="Presentation_Type" id="Oral" checked="checked" value="Oral" />')?><font face="Verdana">Oral</font></td>
<td><?=add('<input type="radio" name="Presentation_Type" id="Poster" value="Poster" />')?><font face="Verdana">Poster</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<table border="0" cellspacing="0" cellpadding="25">
<tr>
<td><input type="image" name="Submit" src="images/continue.gif" alt="" tabindex="7"/></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>