Click here to Skip to main content
16,017,502 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is editmaster.php what is this error and i think everything well defined .someone help me.

What I have tried:

<?php session_start();
    include("../dbConfig.php");
    include "navigation.php";
    include "header.php";
    include "footer.php";

{

} 
	            $item_id = '';
				$item_name = '';
				$description = '';
				$item_category = '';
				$pic = '';
				if (isset($_POST['updateitem']))
				{

				    if (is_numeric($_POST['item_id']))
				{

					$item_id = $_POST['item_id'];
					$item_name = mysql_real_escape_string(htmlspecialchars($_POST['item_name']));
					$description = mysql_real_escape_string(htmlspecialchars($_POST['description']));
					$item_category = mysql_real_escape_string(htmlspecialchars($_POST['item_category']));
					$pic = mysql_real_escape_string(htmlspecialchars($_POST['pic']));

				if ($item_name == '' || $description == '' || $item_category == '' || $pic == '')
				{

				$error = 'ERROR: Please fill in all required fields!';

				valid($item_id, $item_name, $description, $item_category, $pic, $error);
				}
				else
				{

				mysql_query("UPDATE lost_items_table SET item_name = '$item_name', description = '$description', item_category = '$item_category', pic = '$pic' WHERE item_id = '$item_id'")
				or die(mysql_error());

				header("Location: viewitems.php");
				}
				}
				else
				{

				echo 'Error!';
				}
				}
				else

				{

				if (isset($_GET['item_id']) && is_numeric($_GET['item_id']) && $_GET['item_id'] > 0)
				{

				$item_id = $_GET['item_id'];
				$result = mysql_query("SELECT * FROM lost_items_table WHERE item_id=$item_id")
				or die(mysql_error());
				$result1 = mysql_fetch_array($result);

				if($result1)
				{

				$item_name = $result1['item_name'];
				$description = $result1['description'];
				$item_category = $result1['item_category'];
				$pic = $result1['pic'];

				valid($item_id, $item_name, $description, $item_category, $pic,'');
				}
				else
				{
				echo "No results!";
				}
				}
				else

				{
				echo 'Error!';
				}
}

?>


					
	   <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">	            
					            <!-- /.row -->
					            <div class="row">
					                <!--div class="col-md-8 col-md-offset-4"-->
					                <div class="col-lg-6">
					                    <div class="Register-panel panel panel-default">
					                    <!--div class="panel panel-default"-->
					                        <div class="panel-heading">
					                            Edit Item
					                        </div>
					                        <div class="panel-body">
					                            <div class="row">
					                                <div class="col-lg-6">
					                                	<div class="panel-body">
						                            		<form role="form" action="adminPage.php">
						                            					<input type="text" name="item_id" value=<?php echo $item_id; ?> readonly><br>
						                            					<input type="text" name="item_name" required autofocus placeholder="Item-Name" value=<?php echo $item_name; ?>><br>
						                            					<input type="text" name="description" required autofocus placeholder="Description" value=<?php echo $description; ?>><br>
						                            					<input type="text" name="item_category" required autofocus placeholder="Item_category" value=<?php echo $item_category; ?>><br>
						                            					<input type="text" name="pic" required autofocus placeholder="pic" value=<?php echo $pic; ?>><br>

						                            					<input type="submit" name="updateitemBtn" value="Update">
						                            		</form>
						                                </div>
					                                </div>
					                                <!-- /.col-lg-6 (nested) -->
					                            </div>
					                            <!-- /.row (nested) -->
					                        </div>
					                        <!-- /.panel-body -->
					                    </div>
					                    <!-- /.panel -->
					                </div>
					                <!-- /.col-lg-12 -->
					            </div>
					            <!-- /.row -->
			</div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->
Posted
Updated 13-Jul-18 0:31am

1 solution

The error message is quite clear. There is no function valid() defined in the file editmaster.php or any of the included files.

You have to implement it:
PHP
<?php
function valid($arg1, $arg2, $arg3, $arg4, $arg5, $arg6)
{
    // Do the work here

    // Optional return value
    // return $retval;
}
?>
 
Share this answer
 
Comments
harristars 13-Jul-18 6:39am    
thanks men it have worked

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900