miradoro
04-26-2005, 02:05 PM
hI
MY ORIGINAL FORM IS :
<form name="frmSearch" method="post" action="body_dwm_products.php">
Enter Part Number to Search For. For this demo, product IDs are 30201029 and sb0589: <br>
<input name="part_num" type="text" id="part_num">
<input type="hidden" name="action" value="search">
<input type="submit" name="Submit" value="Search">
<?php require_once('form_error.php'); ?>
</form>
AS YOU CAN SEE IT GOES TO ANOTHER PHP PAGE...I WOULD LIKE TO KNOW IF I CAN AVOID THAT...
body_dwm_products.php IS AS FOLLOW:
<form name="frmSearch" method="post" action="body_dwm_products.php">
Enter Part Number to Search For. For this demo, product IDs are 30201029 and sb0589: <br>
<input name="part_num" type="text" id="part_num">
<input type="hidden" name="action" value="search">
<input type="submit" name="Submit" value="Search">
<?
// user sets the file name here.
$data_file = "testdb.txt";
$prt = $_POST['part_num'];
$dataset = file("testdb.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.
?>
<font color="red">
<?
$error_msg = "";
if( $pdfPath == "" ){
$error_msg = "no part was found for $prt";
}
echo( $error_msg );
?>
</font>
</form>
hook me up
BYE
MY ORIGINAL FORM IS :
<form name="frmSearch" method="post" action="body_dwm_products.php">
Enter Part Number to Search For. For this demo, product IDs are 30201029 and sb0589: <br>
<input name="part_num" type="text" id="part_num">
<input type="hidden" name="action" value="search">
<input type="submit" name="Submit" value="Search">
<?php require_once('form_error.php'); ?>
</form>
AS YOU CAN SEE IT GOES TO ANOTHER PHP PAGE...I WOULD LIKE TO KNOW IF I CAN AVOID THAT...
body_dwm_products.php IS AS FOLLOW:
<form name="frmSearch" method="post" action="body_dwm_products.php">
Enter Part Number to Search For. For this demo, product IDs are 30201029 and sb0589: <br>
<input name="part_num" type="text" id="part_num">
<input type="hidden" name="action" value="search">
<input type="submit" name="Submit" value="Search">
<?
// user sets the file name here.
$data_file = "testdb.txt";
$prt = $_POST['part_num'];
$dataset = file("testdb.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.
?>
<font color="red">
<?
$error_msg = "";
if( $pdfPath == "" ){
$error_msg = "no part was found for $prt";
}
echo( $error_msg );
?>
</font>
</form>
hook me up
BYE