Jump to content

Submiting data to mysql with html form


david4ie

Recommended Posts

Hello

I have a car ads site and i have made a dealer sign up form, i want to submit my data to a mysql table.
I have written a script but i cant seem to get it to work i keep getting this error
[b]Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/irishmot/public_html/reg2.php on line 56[/b]

Here is the script.

[code]<tbody><tr>
  <td class="middle_head" align="center">&nbsp;</td>
</tr>
<tr>
  <td valign="top"> <div style="border: 1px solid rgb(204, 204, 204); padding: 5px; margin-top: 5px;">
    <form method="post" enctype="multipart/form-data">
    <table cellpadding="5" cellspacing="5">
      <tbody>
      <tr>
        <td width="121" class="caption">Login<font color="red">*</font></td>
        <td width="221"><input name="login" value="" style="border: 1px solid navy;" type="text"></td>
      </tr>
      <tr>
        <td class="caption">Password<font color="red">*</font></td>
        <td><input name="password[original]" style="border: 1px solid navy;" type="password"></td>
      </tr>
      <tr>
        <td class="caption">Password Confirm<font color="red">*</font></td>
        <td><input name="password[confirm]" style="border: 1px solid navy;" type="password"></td>
      </tr>
      <tr>
        <td class="caption">E-mail<font color="red">*</font></td>
        <td><input name="e-mail" value="" style="border: 1px solid navy;" type="text"></td>
      </tr>
      <tr>
        <td class="caption"><input name="priceplan" type="hidden" id="priceplan" value="Dealer"></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="caption">Contact info</td>
        <td><input name="11" value="" style="border: 1px solid navy;" type="text"></td>
      </tr>
      <tr>
        <td class="caption">Dealer name<font color="red">*</font></td>
        <td><input name="12" value="" style="border: 1px solid navy;" type="text"></td>
      </tr>
      <tr>
        <td class="caption"><input name="13" type="hidden" id="13"></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="caption">Dealer logo</td>
        <td><input name="14" value="" style="border: 1px solid navy;" type="file"></td>
      </tr>
      <tr>
        <td colspan="2" align="right"><input value="Register" class="button" type="submit"></td>
      </tr>
      </tbody>
    </table>
    </form>
  </div></td>
</tr>
</tbody>
<?php

$12 = $_POST['12'];
$13 = $_POST['13'];
$pass1 = $_POST['password[original]'];
$user = $_POST['login'];
$11 = $_POST['11'];
$pass2 = $_POST['password[confirm]'];
$email = $_POST['e-mail'];
$14 = $_POST['14'];
$priceplan = $_POST['priceplan'];


$username="user";
$password="pass";
$database="db";

$conn = @mysql_connect(localhost,$username,$password);

$rs = @mysql_select_db($database, $conn) or die( "Unable to select database");

$id = rand (11111, 99999)
$activation_key = rand (11111, 99999);
$current_date = date("Y-m-d");
$sql = "INSERT INTO `users`(`activation_key`, `reg_date`, `11`, `12`,`13`, `14`, `login`, `password`, `e-mail`, `priceplan`, `id`, ) VALUES('".$activation_key."', ".$current_date."', '"$11"', '"$12"', '"$13"', '"$14"', '"$user"', '"$pass1"', '"$email"', '"$priceplan"', '"$id"')";

$rs = mysql_query( $sql, $conn );

if ($rs) {
$res .= 'Registration succeeded. Thank you';
}
$res = '<div style="border:1px solid #cccccc;margin-top:5;padding:5">'.$res.'</div>';
echo ($res);
?>
[/code]

Thank you,
Link to comment
https://forums.phpfreaks.com/topic/29583-submiting-data-to-mysql-with-html-form/
Share on other sites

give this a shot:

[code]
$sql = "INSERT INTO users(activation_key, reg_date, 11, 12, 13, 14, login, password, e-mail, priceplan, id, ) VALUES('$activation_key', '$current_date', '$11', '$12', '$13', '$14', '$user', '$pass1', '$email', '$priceplan', '$id')";
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.