Hi
i have this code that reads a txt file and pop ups a pdf if a part number is associated with it. if a part number is enter and it is not in the txt file a warning shows. my problem is that the warning stays on the page even if you refresh it...is there a way to clear it ?
Heres the code:
<form name="frmSearch" method="post" action="<?php echo $PHP_SELF;?>" onSubmit="return verifyForm(this);">
<td align="center" background="images/Website_13a.jpg">
<input type="hidden" name="action" value="search">
<?
// user sets the file name here.
$data_file = "testdb2.txt";
$prt = $_POST['part_num'];
$dataset = file("testdb2.txt");
$pdfPath = "";
if( $prt != "" && $_POST['action']=="search" )
{
for( $i = 0; $i < count( $dataset ); $i++ ){
// extract the record key and compare
$dataset[$i] = trim( $dataset[$i] );
$record_key = strtok( $dataset[$i], " " );
$record_key = trim( $record_key );
if( strcmp( $record_key, $prt ) == 0 ) {
$stringArray = explode( " ", $dataset[$i], 2 );
$pdfPath = trim( $stringArray[1] );
?>
<script language="JavaScript" type="text/javascript">
window.open('<?echo($pdfPath);?>');
</script>
<?
break;
} // end of if
} // end of for
} // end of outermost if
// if it gets to this point, the record was not found in the file.
?>
<input name="part_num" type="text" id="part_num" size="12"></td>
<td width="32"><input type="image" src="images/Website_14.jpg" name="Submit" value="Search"></td>
<!--displayin error -->
<font color="red" style="font-family:Arial, Helvetica, sans-serif" size="-1">
<?
$error_msg = "";
if( $pdfPath == "" ){
$error_msg = "Warning: No Record was found associated to Part Number $prt";
}
echo( $error_msg );
?>
</font>
<!--displayin error end -->
</form>




Reply With Quote


Bookmarks