数据显示在组合框上但不在输入框中

时间:2016-12-28 23:00:01

标签: php

$servername = "localhost";
$username = "estgv15577";
$password = "*********";
$dbname = "estgv15577";

       // Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
   // Check connection
if (!$conn)
     {
    die("Connection failed: " . mysqli_connect_error());
     }
      ?> 
<?

                      if(isset($_POST["loadbtn"]))
        {

            $titulo =$_POST["TITULO"];

            $query = "SELECT TITULO,DESCRICAO,URL_IMAGEM,URL_PAGINA FROM PARCERIAS where TITULO= '$titulo' ";
            $result = mysqli_query($conn, $query);

            $details = mysqli_fetch_array($result);

            $titulo = $details["TITULO"];
            $descricao = $details["DESCRICAO"];
            $urlimagem = $details["URL_IMAGEM"];
            $urlpagina = $details["URL_PAGINA"];
            $parcerias = $details["PARCERIAS"];
        }

        $sql = "SELECT * FROM PARCERIAS";

        $result = mysqli_query($conn, $sql);
        echo '<div class="absolute">';
         echo '<form id="form" method="post">';
            echo "<select name ='titulo'>";
            echo "<option value=''>Selecione Parceria</option>";
        echo '</div>';
            while($row = mysqli_fetch_array($result)) 


              {
              echo "<option value='" . $row['TITULO'] . "'>" . $row['TITULO'] . "</option>";
              }
              echo "</select>";



            $conn->close();
            ?> 

  <input type="submit" value="Carregar" name="loadbtn">


          </div>
          <br/>

        </form>

     <div class="container">

    <div class="row">
        <div class="col-lg-12 text-center">

                <br>

          <div class="jumbotron">
    <h3>Alterar Registos</h3>
    <form method="post" autocomplete="disable" enctype="multipart/form-data"> 
    <h5>Dados Parceria</h5>
    <div class="input-group">
          <span class="input-group-addon">Titulo:</span>
          <input type="text" class="form-control" placeholder="" name="titulo" value="<?php echo $titulo;?>" />
        </div>
        <div class="input-group">
          <span class="input-group-addon">Descricao:</span>
          <input type="text" class="form-control" placeholder="" name="descricao" value="<?php echo $descricao;?>" />
        </div>
        <div class="input-group">
          <span class="input-group-addon">Site:</span>
          <input type="text" class="form-control" placeholder="" name="urlpagina" value="<?php echo $urlpagina?>" />
        </div>

        <br>
        <p>
        <input align="left" type="submit" class="btn btn-primary btn-lg" name="bt_alterar" value="Alterar">
        <input align="right" type="submit" class="btn btn-primary btn-lg" name="bt_eliminar" value="Eliminar">
    </p>
    <p
    </p>
    </div>
            </div>

出于某种原因,这填充了组合框,但它没有在输入框中输入

0 个答案:

没有答案