Jump to content

Not display the form


vtgowtham1993

Recommended Posts

hi there..

        i have try to run this code but it shows only the header file but it wont show the register form...

what is the way to show both header and the form ie register form.....

 

 

 

<?php

require 'connect.php';

if(isset($_POST['first_name'])&&isset($_POST['email_id'])&&isset($_POST['user_name'])&&isset($_POST['password'])){

  $first_name = $_POST['first_name'];

  $sur_name = $_POST['sur_name'];

  $email_id = $_POST['email_id'];

  $user_name = $_POST['user_name'];

  $password = $_POST['password'];

  $password_mdd = md5($password);

  if(!empty($first_name)&&!empty($sur_name)&&!empty($email_id)&&!empty($user_name)&&!empty($password)){

    $query_first_name = mysql_query("INSERT INTO user(first_name,sur_name,email_id,user_name,password,password_mdd) value('$first_name','$sur_name','$email_id','$user_name','$password','$password_mdd')");

  }else{

    echo 'Plese fill all field';

  }

 

}

 

?>

<html>

<head>

<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />

 

<body>

<div id="header">

<img src="images/logo.png" width="124"  height="98" />

 

</div>

<div id="nav">

<ul>

<li class="first"><a href="home.php"><em>H</em>OME</a></li>

<li><a href="resume.php"><em>R</em>ESUME</a></li>

<li><a href="photo.php"><em>P</em>HOTOS</a></li>

<li><a href="contact.php"><em>C</em>ONTACTS</a></li>

<span><li><a href="index.php"><em>S</em>IGN IN</a><em>/</em><a href="sign_up.php"><em>S</em>IGN UP</a></li></span>

 

</ul>

</div>

</body>

<div id='center'>

<form action="sign_up.php" method="POST">

     SIGN UP<br><br>

      First Name:<input type="text" name="first_name" ><br>

      Sur Name:<input type="text" name="sur_name"><br>

      Email id: <input type="text" name="email_id"><br>

      Username:<input type="text" name="user_name"><br>

      Password:<input type="password" name="password"><br>

 

      <input type="Register" value="Sign Up">

</form>

</div>

</html>

Link to comment
Share on other sites

A few things to consider:

 

- What's the point of hashing the password if you're going to store the plaintext one too?
- You should not use md5 for password hashing.

- You should sanitize the fields properly before inserting into database

- empty() will also check if variable exists, so using isset() on all variables and then empty() is redundant

- Your sql statement should say VALUES and not VALUE

Link to comment
Share on other sites

Perhaps you just need to validate the code?

http://validator.w3.org/

 

One issue with the HTML code is that you closed the body tag before the form is displayed. The body tag should be right before the close html tag.

</body>
</html>

Also, you should look into the following function:

http://www.php.net/mysql_real_escape_string

 

And in case you're not aware...the mysql_ function have been depreciated. At some point you'll need to look into an alternative database connection:

http://www.php.net/manual/en/mysqlinfo.api.choosing.php

 

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.