PHP: Simple form to posts to database
<p>I've been so out of touch with using PHP outside of content management systems that I've forgot some of the basic syntax etc. What I'm trying to build is a simple form that collects some user data and sends it to a database table called 'creathive_applications'.</p>

<p>Here is my HTML form:</p>

<pre><code>                &lt;form action="&lt;?php bloginfo('home'); ?&gt;" method="post"&gt;
                    &lt;fieldset id="membershipform"&gt;                  
                        &lt;ul class="clearfix"&gt;
                            &lt;li id="li-status"&gt;
                                &lt;span&gt;I am a:&lt;/span&gt;
                                &lt;menu&gt;
                                    &lt;li&gt;&lt;label for="student"&gt;&lt;input disabled="disabled" type="radio" name="status" id="student" checked="checked" value="Graduate" /&gt; Graduate&lt;/label&gt;&lt;/li&gt;
                                    &lt;li&gt;&lt;label for="student2"&gt;&lt;input disabled="disabled" type="radio" name="status" id="student2" value="Undergraduate" /&gt; Undergraduate&lt;/label&gt;&lt;/li&gt;
                                &lt;/menu&gt;
                            &lt;/li&gt;
                            &lt;li id="li-firstname"&gt;
                                &lt;label for="firstname"&gt;First Name&lt;/label&gt; &lt;input name="firstname" disabled="disabled" type="text" placeholder="First Name" id="firstname" title="First Name" /&gt;
                            &lt;/li&gt;
                            &lt;li id="li-lastname"&gt;
                                &lt;label for="lastname"&gt;Last Name&lt;/label&gt; &lt;input name="lastname" disabled="disabled" type="text" placeholder="Last Name" id="lastname" title="Last Name" /&gt;
                            &lt;/li&gt;
                            &lt;li id="li-email"&gt;
                                &lt;label for="email"&gt;Email address&lt;/label&gt; &lt;input name="email" disabled="disabled" type="text" placeholder="Email address" id="email" title="Email address" /&gt;
                            &lt;/li&gt;
                            &lt;li id="li-url"&gt;
                                &lt;label for="url"&gt;URL&lt;/label&gt; &lt;input name="url" disabled="disabled" type="text" placeholder="URL of something you've made" id="url" title="URL of something you've made" /&gt;
                            &lt;/li&gt;
                            &lt;li id="li-buttons"&gt;
                                &lt;input name="submit" type="submit" value="Send Application &amp;#9658;" title="Send Application" onclick="alert('Invites available from March 2011');" /&gt;
                            &lt;/li&gt;
                        &lt;/ui&gt;
                    &lt;/fieldset&gt;
                &lt;/form&gt;
</code></pre>

<p>and here is the PHP jazz:</p>

<pre><code>if(isset($_POST['submit']))

{

    $status = $_POST['status'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $url = $_POST['url'];

    $host = '####';
    $username = '####';
    $pass = '####';

    mysql_connect($host,$username,$pass);
    mysql_select_db($username);

    $query = "INSERT INTO creathive_applications VALUES (NULL,'".$status."','".$firstname."','".$lastname."','".$email."','".$url."')";

    $result = mysql_query($query);

}
</code></pre>

<p>Can anyone help me fix this as I can't remember how to run my SQL statement and send the data to the database :/ Also I've added the database username and password as well as host but what about the database name? Where does that go again?</p>

<p>I know this is a rather n00b question, but any help would be much appreciated.</p>

<p>THANKS A LOT</p>
