Working on a web page that a user picks dropdown box values and submits them to bring up a pdf report
of pipe specifications. The customer is wanting to go from one to two pdf reports based on the selected pipe connection
size. I need to do a if_Else to get the correct pdf but am having a problem trying to reference the variable that holds the connection size. Here is the code. I need to check for the connection before file_get_contents line.Like this:
If Connection this html
( $file = file_get_contents('./techdata_template.html', true);
line.
Else
another html
if (isset($_GET['CONNECTION']) &&
isset($_GET['SIZE']) &&
isset($_GET['WTFT']) &&
isset($_GET['GRADE']) &&
isset($_GET['GRADEKEY'])) {
try {
if (!file_exists('techdata_template.html')) {
echo 'Can\'t find template!';
exit;
}
$stmt = $db->prepare("SELECT * FROM DATATABLE d INNER JOIN CONNECTIONS c ON c.CONNECTION = d.CONNECTION INNER JOIN SIZE s ON s.SIZE = d.SIZE INNER JOIN WTFT w ON w.`WT KEY` = d.`WT KEY` INNER JOIN GRADETABLE g ON g.`GRADE KEY` = d.`GRADE KEY` WHERE c.`CONN KEY` = :connkey AND s.`SIZE KEY` = :sizekey AND d.`WT KEY` = :wtkey AND d.`GRADE KEY` = :gradekey AND g.GRADE = :grade");
$stmt->bindValue(':connkey', $_GET['CONNECTION'], PDO::PARAM_STR);
$stmt->bindValue(':sizekey', $_GET['SIZE'], PDO::PARAM_STR);
$stmt->bindValue(':wtkey', $_GET['WTFT'], PDO::PARAM_STR);
$stmt->bindValue(':gradekey', $_GET['GRADEKEY'], PDO::PARAM_STR);
$stmt->bindValue(':grade', $_GET['GRADE'], PDO::PARAM_STR);
$stmt->execute();
$meta = $stmt->getColumnMeta(0);
$tmp = $stmt->fetchAll();
$file = file_get_contents('./techdata_template.html', true);
$file = str_replace("[CONNECTION]", $tmp[0][0], $file);
$file = str_replace("[SIZE]", $tmp[0][1], $file);
$file = str_replace("[WT/FT]", $tmp[0][3], $file);
$file = str_replace("[GRADE]", $tmp[0]['GRADE'], $file);
$file = str_replace("[WALL]", $tmp[0]['WALL'], $file);
$file = str_replace("[TUBE ID]", $tmp[0]['TUBE ID'], $file);
$file = str_replace("[DRIFT DIA]", $tmp[0]['DRIFT DIA'], $file);