need some PHP form and MySQL help?

Joey

New member
so, i have this php form that my company developer edited for me while on the clock even though this is not work related. it was working, until i got my hands on it and edited a few things out. instead of having me waste another hour of his company time, i've been trying to get it to work. the database is already created and i can't seem to get the data from the populate in the table set in the DB. can somebody please let me know what i'm missing? the form submits without a hitch, but the data is not appearing.

----------------------------here's the file, "form.php"


<h1><a>Haiti Relief Fundraiser</a></h1>
<form id="form_173698" name="form" class="appnitro" method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>">
<div class="form_description">
<h2>Haiti Relief Fundraiser</h2>
<p>All proceeds go directly to the American Red Cross in support of Haiti. A $55 entry fee is required and gets you a free Haiti Relief shirt, 4 hours of bowling, and hours of fun with good people. </p>
</div>
<ul >

<li id="li_1" >
<label class="description" for="first_name">Name </label>
<span>
<input id="element_1_1" name= "first_name" class="element text" maxlength="255" size="8" value="<?php echo(returnformfield('first_name')); ?>"/><input name= "cont_text" style="display:none;visibility:hidden;" value="" />
<label>First</label>
</span>
<span>
<span>
<input id="element_1_2" name= "last_name" class="element text" maxlength="255" size="14" value="<?php echo(returnformfield('last_name')); ?>"/>
<label>Last</label>
</span>
</li><li id="li_2" >
<label class="description" for="email">Email </label>
<div>
<input id="element_2" name="email" class="element text medium" type="text" maxlength="255" value="<?php echo(returnformfield('email')); ?>"/>
</div>
</li><li id="li_3" >
<label class="description" for="element_3">Would you like to participate in the Awesome Bowling Tourney </label>
<span>

<?php

$event_one = returnformfield('event_one');
$event_two = returnformfield('event_two');

?>


<input id="element_3_1" name="event_one" class="element checkbox" type="checkbox" value="1" <?php if ($event_one == "") { echo "checked"; } ?> />
<label class="choice" for="element_3_1">Yes, I am A-W-E-S-O-M-E</label>
<input id="element_3_2" name="element_3_2" class="element checkbox" type="checkbox" value="1" <?php if ($event_two == "") { echo "checked"; } ?> />
<label class="choice" for="event_two">No, I want to watch the A-W-E-S-O-M-E people</label>

</span>
</li><li id="li_4" >
<label class="description" for="bowling_average">Bowling Average (Handicap will be figured from average) BE HONEST </label>
<div>
<input id="element_4" name="bowling_average" class="element text medium" type="text" maxlength="255" value="<?php echo(returnformfield('bowling_average')); ?>"/>
</div>
</li>

<li class="buttons">
<input type="hidden" name="form_id" value="173698" />

<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" onClick="return Verify_Data()" />
</li>
</ul>
</form>

-----------------------------and here's the file, submit.php

<?php

if (strlen(trim($_POST['cont_text'])) > 0) {

echo '
<p class="error center">
<b>In place to keep spammers from doing their naughty deeds.</b>
</p>
';

} else {

// IF for All Required Fields
if ((isset($_POST['first_name']))
AND (isset($_POST['last_name']))
AND (isset($_POST['email']))
) {

// IF for Valid E-Mail Check
if (validate_email($_POST['email']) == 'valid') {

$message = "

".$first_name." ".$last_name."\r
".$email."\r
\r
Event(s):\r
--------------
";
if (isset($_POST['event_one']) && !empty($_POST['event_one'])) { $message .= $event_one."\r
"; }
if (isset($_POST['event_two']) && !empty($_POST['event_two'])) { $message .= $event_two."\r
"; }

$message .= "\r
";

if (isset($_POST['bowling_average']) && !empty($_POST['bowling_average'])) { $message .= "Bowling Average: ".$bowling_average."\r
"; }


$message .= "\r\r

";

$error = 'No';

$mlink = mysql_connect("localhost", "user", "password");
if (!$mlink) {
//die('Could not connect to database');
die('Could not connect: ' . mysql_error());
}

@mysql_select_db("fundraiser")
//or die ('Unable to select database');
or die ('Unable to select database' . mysql_error());

$the_date = date("YmdHis");

$query_cont = "insert into signups values (
'',
'".$the_date."',
'".mysql_real_escape_string($_POST['first_name'])."',
'".mysql_real_escape_string($_POST['last_name'])."',
'".mysql_real_escape_string($_POST['email'])."',
'".mysql_real_escape_string($_POST['event_one'])."',
'".mysql_real_escape_string($_POST['event_two'])."',
'".mysql_real_escape_string($_POST['bowling_average'])."',
)";

$result_cont = mysql_query($query_cont);

mysql_close($mlink);

$title_var = "Fun
 
Back
Top