sql >> Base de Datos >  >> RDS >> Mysql

PHP Form envía datos en blanco a mySQL

La mejor manera de hacerlo es...

<?php

if( isset($_POST['submit']) )
{
    $prefix     =   $_POST['prefix'];
    $firstname  =   $_POST['firstname'];
    $lastname   =   $_POST['lastname'];
    $phone      =   $_POST['phone'];
    $school     =   $_POST['school'];
    $teammate1  =   $_POST['teammate1'];
    $teammate2  =   $_POST['teammate2'];
    $games      =   $_POST['games'];
    $division   =   $_POST['division'];

    mysql_connect("localhost", "acsp", "passwordhidden");
    mysql_select_db("logicgames");
    $order = "INSERT INTO data_logicgames (prefix, firstname, lastname, phone, school, teammate1, teammate2, games, division) VALUES ('$prefix', '$firstname', '$lastname', '$phone', '$school', '$teammate1', '$teammate2', '$games', '$division')";
    $result = mysql_query($order);
    if ($result) {
        echo "<p>Success</p>";
    } else {
        echo "<p>Failed</p>";
    }
}
else
{
    echo "<p>Failed</p>";
}
?>