Reputation: 7
<?php
$id=$_SESSION['id'];
//$date1=date("Y-m-d");
//echo $date1;
$work=$_POST['postinput0'];
//echo $work;
$project_name=$_POST['postinput1'];
$skills=$_POST['postinput2'];
$description=$_POST['postinput3'];
$file1=$_POST['file1'];
$budget=$_POST['postinput4'];
//$radio=$_POST['radio'];
$sql = "INSERT INTO Job_post
(u_id,job_category,project_name,job_sub_category,project_description,image,budget)
VALUES('$id','$work','$project_name','$skills', '$description','$file1','$budget')";
if(mysql_query( $sql, $conn ))
{
echo "successfully";
}
else
{
echo "not successfully inserted";
}
?>
show message before submit button. that i dont want> plz help me.
show message after submit button...... is any error in my code
Upvotes: 0
Views: 239
Reputation: 7
<?php
if(isset($_POST['submit']))
{
$id=$_SESSION['id'];
//$date1=date("Y-m-d");
//echo $date1;
$work=$_POST['postinput0'];
//echo $work;
$project_name=$_POST['postinput1'];
$skills=$_POST['postinput2'];
$description=$_POST['postinput3'];
$file1=$_POST['file1'];
$budget=$_POST['postinput4'];
//$radio=$_POST['radio'];
$sql = "INSERT INTO Job_post (u_id,job_category,project_name,job_sub_category,project_description,image,budget) VALUES('$id','$work','$project_name','$skills', '$description','$file1','$budget')";
$query = mysql_query( $sql, $conn );
if(isset($query))
{
echo "successfully";
}
else
{
echo "not successfully inserted";
}
}
?>
Upvotes: 1
Reputation: 38584
Use this
<?php
$id=$_SESSION['id'];
//$date1=date("Y-m-d");
//echo $date1;
$work=$_POST['postinput0'];
//echo $work;
$project_name=$_POST['postinput1'];
$skills=$_POST['postinput2'];
$description=$_POST['postinput3'];
$file1=$_POST['file1'];
$budget=$_POST['postinput4'];
//$radio=$_POST['radio'];
$sql = "INSERT INTO Job_post (u_id,job_category,project_name,job_sub_category,project_description,image,budget) VALUES('$id','$work','$project_name','$skills', '$description','$file1','$budget')";
$query = mysql_query( $sql, $conn );
if(isset($query))
{
echo "successfully";
}
else
{
echo "not successfully inserted";
}
?>
Edit 01
use isset($_POST[''])
<?php
if(isset($_POST['submit']))
{
$id=$_SESSION['id'];
//$date1=date("Y-m-d");
//echo $date1;
$work=$_POST['postinput0'];
//echo $work;
$project_name=$_POST['postinput1'];
$skills=$_POST['postinput2'];
$description=$_POST['postinput3'];
$file1=$_POST['file1'];
$budget=$_POST['postinput4'];
//$radio=$_POST['radio'];
$sql = "INSERT INTO Job_post (u_id,job_category,project_name,job_sub_category,project_description,image,budget) VALUES('$id','$work','$project_name','$skills', '$description','$file1','$budget')";
$query = mysql_query( $sql, $conn );
if(isset($query))
{
echo "successfully";
}
else
{
echo "not successfully inserted";
}
}
?>
Upvotes: 0