I am tring to take some values from registration.php and post them to #1 Data Base, #2 Send a message to user #3 email value to user and myself.
#2 and 3 work evertime.
As for #1 and posting values to Data base, there are 28 values, If I dont fill in all of the first 13 values, it doesnt post to data base and I can not figure why?
Below is the PHP code for both registration.php and reg.php
Registration.php
Code: Select all
<?php
include("config.php");
if($loged=='yes')
{
echo "$lang[registerloged]";
}
else
{
?>
<font size="2">Only the Username, Passwords and first Email Inputs are required.<br>
Phone, Fax, Street address and Postal code will <b>NOT</b> be visable to others.</font>
<form action="reg.php" method="post">
<table><tr><td><?php echo $lang[username] ?> :</td>
<td><input type="text" name="username"></td></tr>
<tr><td><?php echo $lang[password] ?> :</td>
<td><input type="password" name="password"><BR></td></tr>
<tr><td><?php echo $lang[passwordagain] ?> :</td>
<td><input type="password" name="password2"></td></tr>
<tr><td><?php echo $lang[email] ?> : </td>
<td><input type="text" name="emaila"></td></tr>
<tr><td><?php echo $lang[fname] ?> : </td>
<td><input type="text" name="fname"></td></tr>
<tr><td><?php echo $lang[email] ?> : </td>
<td><input type="text" name="emailz">
<font size="-2">Input Email here <i>again</i> to make Public.</font></td></tr>
<tr><td><?php echo $lang[lname] ?> : </td>
<td><input type="text" name="sname"></td></tr>
<tr><td><?php echo $lang[street] ?> : </td>
<td><input type="text" name="street"></td></tr>
<tr><td><?php echo $lang[street2] ?> : </td>
<td><input type="text" name="street2"></td></tr>
<tr><td><?php echo $lang[city] ?> : </td>
<td><input type="text" name="city"></td></tr>
<tr><td><?php echo $lang[prov] ?> : </td>
<td><input type="text" name="prov"></td></tr>
<tr><td><?php echo $lang[post] ?> : </td>
<td><input type="text" name="post"></td></tr>
<tr><td><?php echo $lang[country] ?> : </td>
<td><input type="text" name="country"></td></tr>
<tr><td colspan="2"><b>Misc. Info </b>(not required)<br></td></tr>
<tr><td><?php echo $lang[phone] ?> : </td>
<td><input type="text" name="phone"></td></tr>
<tr><td><?php echo $lang[fax] ?> : </td>
<td><input type="text" name="fax"></td></tr>
<tr><td><?php echo $lang[hpage] ?> : </td>
<td><input type="text" name="hpage"></td></tr></table>
<b><?php echo $lang[minterests] ?></b>
Check all that apply:<br>
<?php echo $lang[pubs] ?> : <input type="checkbox" name="pubs" value="Pubs," >
<?php echo $lang[bgrills] ?> : <input type="checkbox" name="bgrills" value="Bars & Grills,"><br>
<?php echo $lang[clubs] ?> : <input type="checkbox" name="clubs" value="Clubs">
<?php echo $lang[dances] ?> :
<input type="checkbox"
name="dances" value="Dances,">
<br>
<br>
<?php echo $lang[xdancers] ?> : <br>
<?php echo $lang[emale] ?> :<input type="checkbox" name="emale" value="Male,">
<?php echo $lang[efemale] ?> : <input type="checkbox" name="efemale" value="Female,">
<?php echo $lang[eboth] ?> :<input type="checkbox" name="eboth" value="Both Male & Female,"><br><br>
<?php echo $lang[entertain] ?> :<br>
<input type="checkbox" name="mcountry" value="Country,"><?php echo $lang[mcountry] ?>
<input type="checkbox" name="mrock" value="Rock,"><?php echo $lang[mrock] ?> <input type="checkbox"
name="mhiphop" value="Hip Hop,"><?php echo $lang[mhiphop] ?><br>
<input type="checkbox" name="mdance" value="Dance,">
<?php echo $lang[mdance] ?>:
<input type="checkbox" name="mrap" value="Rap,">
<?php echo $lang[mrap] ?>
<input type="checkbox"
name="mmetal" value="Metal,"><?php echo $lang[mmetal] ?><br>
<?php echo $lang[interests] ?> : <TEXTAREA NAME="interests" COLS="40" ROWS="8">
</TEXTAREA><BR>
<input type="submit" value="<?php echo $lang[registerbutton] ?>">
</form>
<?php
}
?>Code: Select all
<?
include("config.php");
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
$query = "SELECT * FROM login where username='$username'";
$result = mysql_query($query, $connection);
$exuser=mysql_numrows($result);
?>
<?php
if($username=='' OR $password=='' OR $password2=='' OR $fname=='')
{
echo "$lang[fillfields]";
}
elseif($password!=$password2)
{
echo "$lang[passdontmatch]";
}
elseif($exuser=='1')
{
echo "$lang[usernameregistered]";
}
else
{
include("config.php");
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
$query = "INSERT INTO login (`username`, `password`, `fname`, `sname`, `email`, `country`, `city`, `interests`, `street`, `prov`, `street2`, `post`, `phone`, `fax`, `hpage`, `pubs`, `clubs`, `dances`, `emale`, `efemale`, `eboth`, `mcountry`, `mrock`, `mhiphop`, `mdance`, `mrap`, `bgrills`, `mmetal`)".
"VALUES ('$username', '$password', '$fname', '$sname', '$emaila', '$country', '$city', '$interests', '$street', '$prov', '$street2', '$post', '$phone', '$fax', '$hpage', '$pubs', '$clubs', '$dances', '$emale', '$efemale', '$eboth', '$mcountry', '$mrock', '$mhiphop', '$mdance', '$mrap', '$bgrills', '$mmetal')";
$result = mysql_query($query, $connection);
echo "$lang[thanksregister]";
$ida= uniqid('message');
$ida2= uniqid('$ida');
$nr= uniqid($ida);
$date=date('m.j.Y');
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
$query = "SELECT * FROM usermessages";
$query = "INSERT INTO usermessages (`nomer`, `to`, `from`, `date`, `title`, `message`, `new`) VALUES ('$nr', '$username', 'admin', '$date', '$lang[adminwelcome]', '$lang[adminwelcomemessage]', 'yes')";
$result = mysql_query($query, $connection);
}
?>
<?php
$subject="New Member";
//Build your email BODY and assign to var $message
$message.="Thank you for Registering in the TorontoDrinks.com Membership Club \n";
$message.=" Here are the Details of your account.\n";
$message.="Username: $username\n";
$message.="Password: $password\n";
$message.="First Name: $fname\n";
$message.="Sir Name Name: $sname\n";
$message.="EmailA : $emaila\n";
$message.="EmailZ: $emailz\n";
$message.="Street: $street\n";
$message.="Street2: $street2\n";
$message.="City: $city\n";
$message.="Prov: $prov\n";
$message.="Country: $country\n";
$message.="Postal Code: $post\n";
$message.="Misc: $phone $fax $hpage\n";
$message.="Interests: $pubs $clubs $dances $bgrills\n";
$message.="Exotic Dancers: $emale $efemale $eboth\n";
$message.="Bands: $mcountry $mrock $mhiphop $mdance $mrap $mmetal\n";
$message.="Comments: $interests\n";
//Continue until you are satisfied with your message body
$headers.="From: $username <$emaila>\r\n";
$headers.="Reply-To: $emaila\r\n";
$headers.="CC: $emaila\r\n";
// You can find more mail headers at PHP.net
//Formulate mail function here
$send=mail("tdclub@planethax.com",$subject,$message,$headers);
?>:(