Ich möchte die $Row Werte außerhalb der While schleife benutzen. Leider geht das nicht so, wie ich dachte. Evtl kann mir jemand helfen.
Ich möchte die jeweiligen $Row Werte in jeweils ein Input feld packen.
PHP Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form name='event_add' action"javascript.php" method='post'>
<select name='Eingabe' onchange='var i = document.forms[0].Eingabe.selectedIndex; document.forms[0].Ausgabe.value=document.forms[0].Eingabe.options[i].value;document.forms[0].Ausgabe1.value=document.forms[0].Eingabe.options[i].value;' >
<?php
$q = ($_GET['q']);
$con = mysqli_connect('localhost:3307','root','1234','justin');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"ajax_demo");
$sql="SELECT * FROM adress WHERE lastname = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<br>";
while($row = mysqli_fetch_array($result)) {
echo '<option value = '.$row["firstname"]."|".$row["lastname"]."|".$row["street"]."|".$row["PLZ"]."|".$row["number"]."|".$row["email"]. '>' .$row["firstname"] . " " .$row["lastname"]. "</option>";
}
//echo "<input type='' name='Ausgabe2' value=".$row["firstname"]."></input>";
echo '</select>';
echo "<br>";
//$name="Justin";
//echo "<a href='javascript.php?name=".$row['firstname']."'>".$name." einf�gen</a>";
mysqli_close($con);
?>
<br>
<?php echo "<input type='' name='Ausgabe' value='Ausgabe'></input>"; ?>
<br>
<?php echo "<input type='' name='Ausgabe1' value='Ausgabe1'></input>"; ?>
<br>
<input class="sende01" value="Senden" type="submit">
</form>
</body>
</html>
Givemoney