Jump to content

Notice: Undefined index: username in


Ibshas25

Recommended Posts

errors shown below cant understand why its not defined????

 

 

Notice: Undefined index: username in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 4

 

Notice: Undefined index: name in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 5

 

Notice: Undefined index: surname in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 6

 

Notice: Undefined index: password in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 7

 

Notice: Undefined index: email in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 8

 

Notice: Undefined index: contact in /export/SOI-50/students/m2009/abhr428/web/WebIbs/userRegProcess.php on line 9

save_failed

 

 


<!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>
<title>User Register</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="stylesheet1.css"/>
<script type="text/javascript" src="jquery-1.4.3.js"></script>
<script type="text/javascript" src="jquery.json-2.2.js"></script>
<script type="text/javascript" src="forms.js"></script>
<script type="text/javascript" src="saveUser1.js"></script>
</head>
<body>
<center>
<div style="width:280pt;height:350pt;border:5px solid #FFFFFF;">
  <div id= "logo1"><img src="images/FINALlogo.jpg" width="60" height="50" /></div>



<form id="user_details" action="userRegProcess.php" method="post">
<h1>User Registration form</h1>
    <legend> Enter Detail Below</legend>
    
    <br />
    <table>
    <fieldset>

<tr><td width="241"><label for="name">Username</label>
	<tr><td><input type="text" name="username"/></tr></td>

        <tr><td><label for="name">Name </label>
	<tr><td><input type="text" name="name"/></tr></td>

        <tr><td><label for="name">Surname</label>
	<tr><td><input type="text" name="surname" width="200"/></tr></td>

        <tr><td><label for="name">Enter password</label>
	<tr><td><input type="text" name="password" width="200"/></tr></td>

        <tr><td><label for="name">Email Address</label>
	<tr><td><input type="text" name="email" width="250"/></tr></td>

        <tr><td><label for="name">Contact</label>
	<tr><td><input type="text" name="contact" width="250"/></tr></td>

        
       
	<tr><td><button type="button" onclick="processUserDetails();">Submit</button></td></tr>
	<div style="clear:both;"></div>

    </fieldset>
    </table>
    
</form>
</div>

 

 


<?php

// Retrieve form data
$username = $_POST['username'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$password = $_POST['password'];
$email = $_POST['email'];
$contact = $_POST['contact'];

if (!$username || !$name || !$surname || !$Password || !email || !contact) {
echo "save_failed";
return;
}


$db = array(
'host' => 'vega.soi.city.ac.uk',
'login' => 'abhr428',
'password' => '040010722',
'database' => 'abhr428',
);
$link = @mysql_connect($db['host'], $db['login'], $db['password']);
if (!$link) {
echo "save_failed";
return;	
}
mysql_select_db($db['database']);

// Clean variables before performing insert
$clean_username = mysql_real_escape_string($username);
$clean_name = mysql_real_escape_string($name);
$clean_surname = mysql_real_escape_string($surname);
$clean_password = mysql_real_escape_string($password);
$clean_email = mysql_real_escape_string($email);
$clean_contact = mysql_real_escape_string($contact);


// Perform insert
$sql = "INSERT INTO users (usr_id, usr_name, usr_surname, usr_password, usr_email, usr_contact) VALUES ('{$clean_username}', {$clean_name}, '{$clean_surname}', '{$clean_password}', '{clean_email}', '{clean_contact}')";
if (@mysql_query($sql, $link)) {
echo "success";
@mysql_close($link);
return;
} else {
echo "save_failed";
@mysql_close($link);
return;
}

?>

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.