Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About fuzzylr

  • Rank
  • Birthday 11/03/1974

Previous Fields

  • Languages
    HTML5, CSS3, PHP, C++

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
    Fredericksburg, VA
  • Interests
    Cars, computers, girls
  1. Never mind. I figured it out. I needed to tranlate the data with mysql_fetch_array $query = mysql_query("SELECT * FROM $Table Where email='$Email'");$query_row=mysql_fetch_array($query);if($query_row == NULL){ mysql_query($insert); header( 'location: complete.htm');}else { header( 'location: error.htm'); }
  2. Ok, I have fixed the problem with posting the date times to the database. I have one last issue. I want the code to do a check in the DB to make sure the email does not already exist. here is my code. It either constantly denies the write or just always lets it through. I have a feeling it's not pulling data out of the database to compare to. $result = mysql_query("SELECT * FROM $Table Where email = '$Email'");echo $result;if($result !== $Email){ mysql_query($insert); header( 'location: complete.htm');}else { header( 'location: error.htm'); }
  3. Greetings, I am really new at coding php. I have been working for a while and doing some Google searches. I am trying to make a registeration page for something I am working on. I can get everything in the database but dates & times. Right now it's all bogus information. I am curious on how to take a date (like a birthday) and write it to my MySql datebase? Every attempt I have made that is the only piece that doesn't get written. Also I am having an issue with the php date getting into the database. Html code <!DOCTYPE HTML><html><head><title>Demo Game</title></head><body><h1>Test page</h1><p>This is a demo page. More to come.</p><p>In the area below. You will find a location for registration. Please attempt to make an account.</p> <!-- Divide for form formatting --> <div id="container" style="width:250px"><!-- Form for registering new users into the game. --><form id="register" action="reg.php" method="post"> <fieldset> <legend>Registration</legend> <div id="col1" style="width:75px; float:left;"> Username:<br> Password:<br> First name:<br> Last name:<br> Birthday:<br> Email: </div> <div id="input" style="width:100px; float:left;"> <input type"text" name="username" placeholder="Username" required autofocus><br> <input type="password" name="password" placeholder="Password" required><br> <input type"text" name="fname" placeholder="First Name" required><br> <input type"text" name="lname" placeholder="Last Name" required><br> <input type="date" name="bday" placeholder="(MM/DD/YYYY)" required><br> <input type="email" name="email" placeholder="Email address" required> </div> <div id="gender" style="text-align:center; clear:both;"> Gender: <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select><br><br> </div> <input type="submit" value="Register"> </fieldset></form></div> </body></html> php code <?php// Variables//$Date = now();$User = "";$Password = "";$Database = "testgame";$Table = "players";$Host = "localhost";$sqlDate = date('Y-m-d H:i:s'); //Check to make sure variables are set from index.htmif(isset($_POST[username]) && isset($_POST[password]) && isset($_POST[fname]) && isset($_POST[lname])&& isset($_POST[bday]) && isset($_POST[email]) && isset($_POST[gender])){// Connect to the servermysql_connect($Host, $User, $Password) or die (mysql_error()); //Check connectivitymysql_select_db($Database) or die(mysql_error()); // Insert data into DB$insert = "INSERT INTO $Table (username, password, name, last, email, birthday, registered, gender) VALUES('$_POST[username]', '$_POST[password]', '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[bday]', '$sqlDate', '$_POST[gender]')"; //Check to see if the name exists (no duplicates)$result = mysql_query("SELECT * FROM $Table Where email = '$_POST[email]'"); echo $_POST[email]; if($result){ if(!mysql_query($insert)) { die (mysql_error()); echo "Record added. "; }}else { echo "Email already used."; } mysql_close($con); } //End of check ?>
  4. Thank you. This worked very well. header('Location: driven' . $num . '.html');}
  5. Expectation of code: I would like it to take the number the customer selects and based on that number load a different page. So you load into index.php The options are 1 - 4. I am receiving the information into Variables. However, it's not changing the page. Here is the code for it to change the page. header('Location: driven' + $num + '.html');} Also is there a better way of breaking out of php code? <?phpif(isset($_POST['submit'])){echo "Submit button has been pressed"; ?><br /><?phpecho $num; ?><br /><?phpif ($num < 1){ $error="Invalid option"; echo $error;}else{ header('Location: driven' + $num + '.html');}}?> Notice all the <?php ?> ??
  6. Switching it to php resolved the issue. thanks guys :-)
  7. Setting it index.php does not change the status. It's not displaying any information <?php$Name = $_POST['name'];$Age = $_POST['age'];?><!DOCTYPE HTML><html><head><title>Test PHP page</title></head><body><form method="post" action="index.php"><label>Name:</label><input type="text" name="name" required><label>Age:<lable><input type="number" name="age" required><input type="submit" value="Submit" name="submit"></form></body></html><?php// Testing to see if the submit button is workingif (isset($_POST['submit'])){echo "You have hit submit";echo $Name;echo $Age;}?>
  8. It's not printing at all. It's very wierd. Here is a very simple version of what I am trying to accomplish. It won't even do what it's suppose to. index.html <!DOCTYPE HTML><html><head><title>Test PHP page</title></head><body><form method="post" action=""><label>Name:</label><input type="text" name="name" required><label>Age:<lable><input type="number" name="age" required><input type="submit" value="Submit" name="submit"></form></body></html><?php echo $_REQUEST['name'] ?><br /> <?php echo $REQUST['age'] ?>
  9. Believe it or not it's not posting. It's not doing anything with the information. I've validated both html and php. I created a much simpler version of the code. It's still not working. I'm going to post up in the php forums.
  10. I am not sure which version of html your trying to write the code in. Here is a good example of how you could do it in HTML5. http://www.w3schools.com/html5/tag_nav.asp
  11. Well maybe not. It doesn't seem to be submitting the number.
  12. Actually, it still wasn't working. So what I did was turn my script into a function. I then added that function to the action piece. I need to create the 4 pages. However, I believe it is working. Functionfunction number($num){if ($num < 1){ $error="Invalid option";} else{ header('Location: driven' + $num + '.html');}} Update to Form <form method="get" action='<?php echo $_SERVER['number($num)']>
  13. I've not touched PHP in a while. I was never really all that good at it. So what your saying is convert my php script to a function and just add that to in place of the script name? I read through the php page you posted. I believe in order for this to work I'd have to convert to a function? Would you mind expanding on this? Maybe I'm over complicating the subject.
  14. Greetings, I am trying to write a small page where the user selects how many users. I want to use a drop down list. I believe I have everything in place. However, I can not get the submit information into my php script. Any thoughts? HTML / PHP code <?php$num=$_POST["num"];$errorif ($num < 1) $error="Invalid option";if ($num == 1) header('Location: driven1.html');if ($num == 2) header('Location: driven2.html');if ($num == 3) header('Location: driven3.html');else header('Location: driven4.html');?><!DOCTYPE HTML><html><head><link href="driven1.css" rel="stylesheet" type="text/css"/><title>Driven support request</title></head><body><?php echo $error ?><div class="body"><header class="header"><!--Accelera logo--><img src="AcceleraLogo.jpg" alt="Accelera Logo" /></header><div class="div1"><form method="get"> <fieldset class="user1"> <label>How many users?</label> <br /> <select name="num"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4+">4+</option> </select> <br /> <input type="submit" value="Submit" /> </fieldset></form></div></div></body></html>
  15. Yes it does. It just kept looping. It was kinda neat. Apache sort of held it's own before I terminated it.
  • Create New...