Create a PHP query to insert into the table

0

Hello, how can I create a query in php that clicks the insert button in the table?

My code:

    <?php

$error = null;
$sucses = null;

if(isset($_POST['Promo'])) {
        $AwardID = $_POST['AwardID'];
        $ActiveID = $_POST['ActiveID'];
        $PullDown = $_POST['PullDown'];
        if($AwardID == null)
            $error.= 'Houve um erro em AwardID!<br />';
        if($error == null) {
            $q = q("INSERT INTO [dbo].[Active_Number] ([AwardID], [ActiveID], [PullDown]) VALUES('$AwardID', '50', 'False')");
            $sucses = 'O código: "'.$AwardID.'" foi validado com sucesso.<br />';
        }
        }



function geraSenha($tamanho = 18, $maiusculas = true, $numeros = false, $simbolos = false)
{
$lmin = 'abcdefghijklmnopqrstuvwxyz';
$lmai = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$num = '1234567890';
$simb = '!@#$%*-';
$retorno = '';
$caracteres = '';
$caracteres .= $lmin;
if ($maiusculas) $caracteres .= $lmai;
if ($numeros) $caracteres .= $num;
if ($simbolos) $caracteres .= $simb;
$len = strlen($caracteres);
for ($n = 1; $n <= $tamanho; $n++) {
$rand = mt_rand(1, $len);
$retorno .= $caracteres[$rand-1];
}
return $retorno;
}
?>
<div id="tbtoolbar">
<center>
<input name='AwardID' id='AwardID' type='text' maxlength='40' value='<?php echo geraSenha(18, true, false, false); ?>' readonly />
    <button name='Promo' id="Promo" type="submit" class="btn btn-default">Validar código</button>
    <?php echo '<center><div><font color="red">'.$error. '</font></div></center>'; echo '<center><div><font color="green">'.$sucses. '</font></div></center>'; ?></center>
    </center>
</div>
<script>
    
asked by anonymous 12.12.2016 / 20:18

0 answers