Jump to content

Recommended Posts

Hello Everybody,

 

Here's my script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Spotlight</title>
<style type="text/css" media="screen">

	html, body {		
	background-color: transparent;	
	font-family: Tahoma;	
	font-size: 11px;	
	color: #787878;	
	margin: 0 auto;
}

.title {
        margin-bottom: 5px;
        color: #33CCFF;
        font-weight: bold;
border-bottom: 1px solid #FF00FF;
}
#title {
        margin-bottom: 5px;
        color: #33CCFF;
        font-weight: bold;
border-bottom: 1px solid #FF00FF;
}
#title2 {
        margin-bottom: 5px;
        color: #33CCFF;
        font-weight: bold;
border-bottom: 1px solid #FF00FF;
}

		form {

			padding: 0;
			margin: 0;

		}

		.wrapper {

			background-color: #fcfcfc;
			width: 300px;
			margin: auto;
			padding: 5px;
			margin-top: 15px;

		}

		.good, .bad {

			padding: 5px;	
			margin-bottom: 5px;

		}

		.good strong, .bad strong {

			font-size: 12px;
			font-weight: bold;

		}

		.good {

			background-color: #d9ffcf;
			border-color: #ade5a3;
			color: #1b801b;

		}

		.bad {


			background-color: #ffcfcf;
			border-color: #e5a3a3;
			color: #801b1b;

		}

		input, select, textarea {

			border: 1px #e0e0e0 solid;
			border-bottom-width: 2px;
			padding: 3px;

		}

		input {

			width: 170px;

		}

		input.button {

			width: auto;
			cursor: pointer;
			background: #eee;

		}

		select {

			width: 176px;

		}

		textarea {

			width: 288px;

		}

		label {

			display: block;
			padding: 3px;

		}

	</style>
</head>

<body>
<div class="content_container">
            	<div class="center_grey_header">
                	<img src="scripts/header.php?size=7&width=1&text=ADD YOURSELF TO THE SPOTLIGHT!&colour=grey" alt="Welcome To usernamecloud"  />
                </div>
                <div class="center_box">
<br/><center>
<?php 
// Simple username Spotlight Script by Vorth of username UK 

$host="localhost"; // Host name 
$username="usernamefea_spot"; // Mysql username 
$password="michaelwho?!"; // Mysql password 
$db_name="usernamefea_spot"; // Database name 
$tbl_name="spotlights"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

    if ($_POST[spotlight]) { 
    $usernamename = $_POST[usernamename]; 
    $hotel = $_POST[hotel]; 

    if($usernamename==NULL) { 

    echo "Whoops! You left something blank. Please go back and rectify this problem."; 
    }else{ 

    $checkusername = mysql_query("SELECT usernamename FROM usernames WHERE usernamename='$usernamename'"); 
    $checkusername2 = mysql_num_rows($checkusername); 

    if ($checkusername2>0) { 

    echo "Uh-Oh! A username with this name has already been added."; 
    }else{ 

    $usernamename = htmlspecialchars($usernamename); 
    $hotel = htmlspecialchars($hotel); 
    $query = mysql_query("INSERT INTO usernames (usernamename, hotel) VALUES('$usernamename','$hotel')"); 

    echo "Congratulations you have added yourself to our username Spotlight. username's are shown randomly so keep an eye out for yourself."; 

    }}} 

    else { 
    echo ("<form method=\"POST\" action=\"javascript:ajaxpage('_content/spotlight.php', 'center');\"> 
    <b>username Name:</b> <input type=\"text\" size=\"25\" maxlength=\"50\" name=\"usernamename\"><br /> 
    <b>Hotel:</b> 
    <select size=\"1\" name=\"hotel\"> 
    <option selected value=\".co.uk\">username UK</option> 
    <option value=\".com\">username US</option> 
    <option value=\".ca\">username CA</option> 
    <option value=\".com.au\">username AU</option> 
    </select> 
    <br /> 
    <input name=\"spotlight\" type=\"submit\" value=\"Add Me to the Spotlight!\"> 
    </form>"); 
    } 
?>
</body>
</html>


  </div>
                <div class="center_box_bottom"></div> 
            </div>

 

But it doesn't do anything! It just reloads and submits no data what so ever, any help would be great! Thanks!

 

Best Wishes,

Ptsface12

Link to comment
https://forums.phpfreaks.com/topic/243195-form-isnt-doing-anything/
Share on other sites

Add the line I've commented and see if anything is returned after you submit the form. You should also be developing with error_reporting = -1 and display_errors = On in your php.ini file. Right now there are several undefined constant notices being generated that you aren't seeing due to the unquoted array indices.

 

<?php 
// Simple username Spotlight Script by Vorth of username UK

echo '****** POST ARRAY *****<pre>'; print_r($_POST); echo '</pre>****** END POST ARRAY ******'; // <--- ADD THIS LINE

$host="localhost"; // Host name 

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.