Change the screen data change from the ID that is in the Combobox [closed]

0

I'm stuck in the code where I can not return all the bank ID positions in the combobox and I can not seem to change the other fields from that ID. Any help is appreciated right away

Data Query Screen

<?php
   session_start();
    $ID_Cliente = $_SESSION['ID_Cliente'];


    $conexao = mysql_connect("localhost:3306","root","root") or die("Erro durante a conexão do banco de dados");
    mysql_select_db("prestadora",$conexao);
    mysql_query("SET NAMES 'utf8'", $conexao);
    mysql_query('SET character_set_connection=utf8', $conexao);
    mysql_query('SET character_set_client=utf8', $conexao);
    mysql_query('SET character_set_results=utf8', $conexao);
    $consulta= "select * from pedido where ClienteID_Cliente='$ID_Cliente' " ;
    $resultado=mysql_query($consulta,$conexao) or die ("Não foi possível Consultar os seus dados.");


      while($consulta=mysql_fetch_array($resultado)){

        $Tipo_Servico=$consulta["Tipo_Servico"];
        $DataVisita=$consulta["DataVisita"];
        $HoraVisita=$consulta["HoraVisita"];
        $EnderecoVisita=$consulta["EnderecoVisita"];          


      }

        $listarID= "select ID_Pedido from pedido " ;
        $lista=mysql_query($listarID,$conexao) or die ("Não foi possível Consultar os seus dados.");


          while($dados=mysql_fetch_array($lista)){

        $ID_Pedido=$dados["ID_Pedido"]; 

         }  

 ?>

Change Form

<!DOCTYPE html>

<html>
<head>
    <title>Projeto Web-AlterarPedido</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../_css/layoutPrincipal.css">
    <link rel="stylesheet" href="../_css/formulario.css">

</head>
<body>

<header id="cabecalho">
    <img src="../_imagens/logo.jpg">
</header>
<br class="fixFloat">
<nav id="menu">
    <ul>
        <li><a href="../index.html" target="_self">Home</a></li>
        <li><a href="../cadastra-se.html" target="_self">Cadastra-se</a></li>
        <li><a href="../login.html" target="_self">Login</a></li>
    </ul>
</nav>



<section id="form">
    <fieldset id="form_field">
        <legend id="form_legend">Alterar Pedido</legend>

         <?php
        include "listarpedido.php";
              ?>

              <form method="post" action="alterarpedido.php">
                 Escolher qual alterar: <select name="ID_Pedido" id="ID" >
                 <option value="<?php echo $ID_Pedido;?>"><?php echo $ID_Pedido;?></option> 
                  </select><br/><br/>
                 Tipo de Serviço: <select name="Tipo_Servico"  value="<?php echo $Tipo_Servico;?>">
                 <option name="Reforma Predial">Reforma Predial</option>
                 <option name="Jardinagem">Jardinagem</option>
                 <option name="Eletricista">Eletricista</option>
                 <option name="Encanador">Encanador</option>
                 </select> 
                 Data de Visita: <input type="text" name="DataVisita" value="<?php echo $DataVisita;?>">  
                 Hora de Visita: <input type="text" name="HoraVisita" value="<?php echo $HoraVisita;?>"><br/><br/>
                 Endereço de Visita: <input type="text" name="EnderecoVisita" value="<?php echo $EnderecoVisita;?>" >
                <fieldset id="form_field">
                      <legend id="form_legend">Alterar</legend>
                      <input type="submit" id="botao" value="Alterar">
                      <input type="reset" id="botao" value="Resetar">
                </fieldset>
            </form>

</section>


</body>
</html>

Query Screen to Change Data in the Bank

<!DOCTYPE html>

<html>
<head>
    <title>Projeto Web-AlterarCadastro</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../_css/layoutPrincipal.css">
    <link rel="stylesheet" href="../_css/formulario.css">

</head>
<body>

<header id="cabecalho">
    <img src="../_imagens/Logo.jpg">
</header>
<br class="fixFloat">
<nav id="menu">
    <ul>
        <li><a href="../index.html" target="_self">Home</a></li>
        <li><a href="../cadastra-se.html" target="_self">Cadastra-se</a></li>
        <li><a href="../login.html" target="_self">Login</a></li>
    </ul>
</nav>


<section id="form">
    <?php

    $ID_Pedido=$_POST["ID_Pedido"];
    $Tipo_Servico=$_POST["$Tipo_Servico"];
    $DataVisita=$_POST["DataVisita"];
    $HoraVisita=$_POST["HoraVisita"];
    $EnderecoVisita=$_POST["EnderecoVisita"];




    $conexao = mysql_connect("localhost:3306","root","root") or die("Erro durante a conexão do banco de dados");
    mysql_select_db("prestadora",$conexao);
    mysql_query("SET NAMES 'utf8'", $conexao);
    mysql_query('SET character_set_connection=utf8', $conexao);
    mysql_query('SET character_set_client=utf8', $conexao);
    mysql_query('SET character_set_results=utf8', $conexao);
    $atualiza= "update cliente set Tipo_Servico='$Tipo_Servico',DataVisita='$DataVisita',HoraVisita='$HoraVisita',EnderecoVisita='$EnderecoVisita' WHERE ID_Pedido='$ID_Pedido'" ;
    mysql_query($atualiza,$conexao) or die ("Não foi possível executar a atualização.");
    mysql_close($conexao);



    echo"<fieldset id='form_field'><legend id='form_legend'>Dados do Pedido</legend>
  <p>Dados do Pedido Alterados com Sucesso !!!</p></fieldset>";



    ?>
<fieldset id="form_field">
     <legend id="form_legend">Voltar</legend>
    <a href="../menucliente.html" id="botao">Voltar</a>
</fieldset>

</section>


</body>
</html>
    
asked by anonymous 31.01.2017 / 21:12

1 answer

1

Initially: in your "Data Query Screen", when reading the returned values (within the "while"), you only assign the results to the variables.

You need to print them to the user, along with some markup, be it a link, a select (combo) and their options, or something like that.

    
01.02.2017 / 06:21