Comment out this and add:
Code: Select all
echo $_POST['jobtype'];
/*
if(isset($_POST['save']))
//Get my data
...
}
*/<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Moderator: General Moderators
Code: Select all
echo $_POST['jobtype'];
/*
if(isset($_POST['save']))
//Get my data
...
}
*/papa wrote:Ok first you must establish if you send data.
Comment out this and add:
Submit your form and see if you get anything. Also add an action to your form header, example:Code: Select all
echo $_POST['jobtype']; /* if(isset($_POST['save'])) //Get my data ... } */
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Submit a Vacancy</title>
<link href="vacancy_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
if(isset($_POST['save']))
//Get my data
{
$jobtitle = $_POST['jobtitle'];
[color=#BF0000]$jobtype = $_POST['jobtype'];[/color]
$area = $_POST['area'];
$salary = $_POST['salary'];
$qualifications = $_POST['qualifications'];
$skills = $_POST['skills'];
$jobdescription = $_POST['jobdescription'];
//open my database
include 'library/configiguration.php';
include 'library/opendatabase.php';
//punt it in :D
$query = "INSERT INTO jobpost (jobtitle, [color=#BF0000]jobtype[/color], area, salary, qualifications, skills, jobdescription) VALUES ('$jobtitle', '$jobtype', '$area', '$salary', '$qualifications', '$skills', '$jobdescription')";
mysql_query($query) or die('Error ,query failed');
//shut it down!!!
include 'library/closedb.php';
//Message to say..you rock.
$msg = "<b>Thank you</b> You want cookie?";
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> [color=#FF8000]//thank you papa[/color]
<table width="490" border="0" align="center" cellpadding="1" cellspacing="5" bgcolor="#fafafa" id="VacancyForm">
<tr>
<td width="146"> </td>
<td width="321"> </td>
</tr>
<tr>
<td colspan="2"><h1>Submit a Vacancy</h1></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><p align="right">Job Title:</p></td>
<td><input name="jobtitle" type="text" class="box" id="jobtitle" /></td>
</tr>
<tr>
<td><p align="right">Job Type:</p></td>
<td><select name="jobtype" class="box" id="jobtype">
<option value="yay">yay</option>
<option value="nay">nay</option>
</select></td>
</tr>
<tr>
<td><p align="right">Area:</p></td>
<td><input name="area" type="text" class="box" id="area" /></td>
</tr>
<tr>
<td><p align="right">Salary:</p></td>
<td><input name="salary" type="text" class="box" id="salary" /></td>
</tr>
<tr>
<td><p align="right">Qualifications:</p></td>
<td><textarea name="qualifications" cols="30" rows="5" class="box" id="qualifications"></textarea></td>
</tr>
<tr>
<td><p align="right">Skills:</p></td>
<td><textarea name="skills" cols="30" rows="5" class="box" id="skills"></textarea></td>
</tr>
<tr>
<td><p align="right">Job Description</p></td>
<td><textarea name="jobdescription" cols="30" rows="5" class="box" id="jobdescription"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="save" type="submit" id="save" value="Submit" />
<input name="reset" type="reset" id="reset" value="Reset" /></td>
</tr>
<tr>
<td colspan="2"><?php echo $msg; ?></td>
</tr>
</table>
</form>
</body>
</html>