Jump to content

registration form


mwq27

Recommended Posts

Whenever I hit submit from the HTML form, I get a blank screen on the php page.  There is something wrong with my code and I just cant figure it out. 
Here is the code [code]<?php

echo 'HWHEEADONASOIOAIDHOIAD';

$host = 'localhost';
$user = 'root';
$pass = 'xxxxx';
$dbname = 'pecs';

$link = mysql_connect($host, $user, $pass);

if(!$link)
{
die("Could not connect: " .mysql_error());
}
mysql_select_db($dbname, $link) or die (" Database not found." . mysql_error());


$email = $_POST['email'];


$name = $_POST['name'];

$title = $_POST['title'];

$address = $_POST['address'];

$city = $_POST['city'];

$state = $_POST['state'];

$zip = $_POST['zip'];

$phone = $_POST['phone'];

$org = $_POST['org'];

$regreg = $_POST['regreg'];

$stureg = $_POST['stureg'];


if(empty($email) || empty($name) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($phone) || empty($org))
    {
    echo 'you didnt fill in all the required fields! go back and do it again...';
  //  echo "<a href=\"javascript:history.go(-1);\">&laquo; back</a>";
    } else {

          // Check to make sure its a valid email, and already exists

        if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {

            $check_email = "SELECT * FROM regform WHERE email='$email'";

                $result = mysql_query($check_email) or die (mysql_error());


                    if (mysql_num_rows($result) > 0) {

                        $email = FALSE;

                        echo 'That email is already being used!<br />';

                    }
//if a radio button hasnt been selected
if(!isset($regreg) && !isset($stureg))
{
echo 'Please select whether you student registration or regular registration.'; }
else {

//set variable to the right radio button
if(!isset($regreg))
{
$regreg = $_POST['stureg'];
}
else $regreg = $_POST['regreg'];

$sql = mysql_query("insert into regform (name, org, title, address, city, state, zip, phone, email, regbef) values ('$name', '$org', '$title', '$address', '$city', '$state', '$zip', '$phone', '$email', '$regreg')");
$result = mysql_query($sql);

if(!result)
echo 'could not register you try again';
//throw new Exception('Could not register you, try again');
else
echo 'Success!!';

}


?>
[/code]

Could someone please tell me what is wrong here.  Thanks
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.