Hey, im having a little trobule with this task!
the basic principle is:
i have a function which generates a unique number containing both letters and numbers (4 long), i have assigned the result of this function to a variable called $id. i want the value of this variable to be the initial value of one my text fields on my html form, to do this i used
<form action="registration_form.php" method="post">
<input type="hidden" name="id" value="<?php echo "$id"; ?>"><br>
First Name:<input type="text" name="fname"><br>
Surname:<input type="text" name="sname"><br>
Mobile No:<input type="text" name="mob"><br>
Email:<input type="text" name="email"><br>
<input type="submit" value="submit">
</form>
this works fine the only problem is when i click submit the data entered into the fields is then inserted into my database, but this doesnt work and i dont understand why the code for this is
<?php
$customer_id = $POST['id'];
$fname = $POST['fname'];
$sname = $POST['sname'];
$mob = $POST['mob'];
$email = $_POST['email'];
?>
<?php
if( $customer_id and $fname and $sname and $mob and $email )
{
$conn = @mysql_connect("some host", "username", "password")
or die("Err:Conn");
$rs = @mysql_select_db( "database", $conn ) or die ( "Err:Db" );
$sql="insert into funki_ink (customer_id, fname, sname, mob, email)
values ( $customer_id, \"$fname\", \"$sname\", \"mob\", \"email\" )";
$rs = mysql_query( $sql, $conn );
if($rs) { echo( "Record Added: $fname $sname $mob $email" ); }
}
?>
can any one help thanks!