this is my code and below are the notices that r shown in browser ..what can i do??

FILE 1: new_user.php

<?php 
require('header.php'); 
?>
<body>

<?php 
require('sql_connect.php'); 
?>

<?php 
require('functions.php'); 
?>


<form method="POST" action="add_new_user.php">
    Username: <input type="text" name="user_name" /></br>
    firstname: <input type="text" name="first_name" /></br>
    lastname: <input type="text" name="last_name" /></br>
    password: <input type="password" name="password" /></br>
    confirm password: <input type="password" name="confirm_pass" /></br>
    Country: 
         <?php
	$q		=	"Select * from countries order by country_name asc";
	$res	=	my_query($q);
	
	?>
    <select name="country">
    <?php
    while($row	=	mysql_fetch_assoc($res)){
    ?>
    	<option value="<?php echo $row['id'];?>"><?php echo $row['country_name'];?></option>
    <?php
    }
    
    ?>
    </select>
    <br />
    User role: 
     <select name="user_role">
        <option value="1">Admin</option>
        <option value="2">Manager</option>
        <option value="3">Staff</option>
     </select>
     <input type="submit" name="submit" value="submit"/></br>
   </form>


<?php 
require('footer.php'); 
?>


FILE 2: add_new_user.php

<?php

require('sql_connect.php');
//require('functions.php');
$user_name	=	($_POST['user_name']);

$first_name	=	($_POST['first_name']);

$last_name	=	($_POST['last_name']);

$password	=	($_POST['password']);

$confirm_pass = ($_POST['confirm_pass']);

$country	=	($_POST['country']);

$user_role	=	($_POST['user_role']);


$query= "insert into users set user_name='".$user_name."',first_name='".$first_name."',last_name='".$last_name."',password='".$password."',country_id='".$country."',user_role='".$user_role."' ";

mysql_query($query);

$q="insert into roles set role_name='".$user_role."'";
mysql_query($q);


echo "all data inserted";

?>

ERROR:
Notice: Undefined variable: user_name in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: first_name in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: last_name in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: password in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: country in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: user_role in C:\xampp\htdocs\management\add_new_user.php on line 23

Notice: Undefined variable: user_role in C:\xampp\htdocs\management\add_new_user.php on line 27
all data inserted

You need to atribute something to those variables before you usen then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.