if (isset ($_POST['Suche'])) {
$vorgabeName = htmlspecialchars($_POST['Suche']);
$sucheGestartet = True;
?>
<script>
document.getElementById("suchePseudoTabelle").style.visibility = "visible";
console.log();
</script>
<?php
}
else {
$vorgabeName = 'Bestellung/ArtNr/EAN/HAN';
$sucheGestartet = False;
}
if(sucheGestartet) {
$serverName4 = "server";
$connectionOptions4 = array("Database"=>"database",
"Uid"=>"login", "PWD"=>"pass");
//Establishes the connection
$conn4 = sqlsrv_connect($serverName4, $connectionOptions4);
//Start Pseudos
$suchePseudos = "abfrage";
//Executes the query
$getSuchePseudos = sqlsrv_query($conn4, $suchePseudos);
//Error handling
if ($getSuchePseudos == FALSE)
die(FormatErrors(sqlsrv_errors()));
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<fieldset>
<label>Suche: <input type="text" size="50" name="Suche" value="<?php echo $vorgabeName; ?>"></label>
</fieldset>
</form>
</br>
<?php
if(sucheGestartet){
while($rowSuche = sqlsrv_fetch_array($getSuchePseudos, SQLSRV_FETCH_ASSOC))
{
$datenSuche[] = $rowSuche;
}
?>
<table id="suchePseudoTabelle" method="POST" class="tabelle" border="1" data-role="table" data-mode="columntoggle" data-column-btn-text="Spalten" >
<thead>
<tr>
<th data-priority="1">Bestellung</th>
<th data-priority="2">ExterneNr</th>
</tr>
</thead>
<tbody>
<?php
foreach ($datenSuche as $inhaltSuche) {
?>
<tr>
<td>
<?php echo $inhaltSuche['Bestellung']; ?>
</td>
<td>
<?php echo $inhaltSuche['ExterneNr']; ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php
sqlsrv_free_stmt($getSuchePseudos);