PHP Combo Box ve Düğme seçme

0 Cevap php

Şu anda 2 tablo ile bir MysSQL veritabanı ile PHP 5 kullanıyorum. Şimdiye kadar benim PHP Combo Kutusu çalışıyor ancak ben açılan kutudan seçilen değerlerine erişmek gerekir. bu gibi gider:

1) I select a value from the Combo Box. 2) I click on the Submit button 3) The Submit button brings me to another webpage.

Ben oluşturulan herhangi bir web sayfası var gönder düğmesine tıkladığınızda benim programı artık karşı karşıya olduğu sorun aşama 3. sırasında. Ben sorun Açılan Kutu Kodları ve Button Kodları sıralanması nedeniyle olduğunu düşünüyorum.

Benim kodlar olarak gösterilmiştir:

<?php
include "db_connect.php";
{
?>
<td valign=top><strong>Name:</strong></td>
<td>

<?php
echo '<select name="table_choice">'; 
echo "<option size =30 selected>Select</option>";

$result = mysql_query("show tables");

if(!$result) trigger_error("Query Failed: ".  mysql_error($db), E_USER_ERROR);

if(mysql_num_rows($result)) 
{ 
while($table_array = mysql_fetch_array($result)) 
{ 
    echo "<option>$table_array[0]</option>";
}  

$array_value = $_POST['table_choice'];

if(!$_POST['submit'])
{
?>

<input type="submit" name="submit" value="Submit">

<?php
 }
 else
{
  echo '<script type="text/javascript">
        alert("Redirecting you to the site main page");
        window.location="echo.php"</script>';
 }

 } 
else 
{
echo "<option>No Names Present</option>";  
} 
}

?>

Her şey iyi gibi geliyor bana.

0 Cevap