Below is my job post code, it cannot post into database... WHAT IS THE PROBLEM OF IT??
[PHP]<?php
session_start() ;
ob_start();
//connect to server and select database
$conn=mysql_con nect("localhost ", "root", "") or die (mysql_error()) ;
mysql_select_db ("ums e-job portal", $conn) or die(mysql_error ());
//If the form was submitted, process it.
if (isset($_POST['submit'])){
$problem=FALSE;
//check for empty value in each mandatory field.
if (empty($_POST['jobTitle'])||empty($_POST['jobType'])||empty($_POST['jobCategory'])||empty($_POST['jobPosition'])||empty($_POST['jobLocation'])||empty($_POST['mRequirement'])||empty($_POST['jobDescription '])){
$problem=TRUE;
echo '<p>Please make sure you enter all the required fields!</p>';
}
//if no problem then insert values into the abstract table in the database.
if (!$problem){
$query = "INSERT INTO job values ( '', '$_SESSION[company_ID]', '$_SESSION[companyName]', '$_SESSION[contactName]' , '$_SESSION[emailAdd]', '$_SESSION[contactNum]', '$_SESSION[contactAdd]', '$_POST[jobTitle]', '$_POST[jobType]', '$_POST[jobCategory]', '$_POST[jobPosition]', '$_POST[jobLocation]', '$_POST[mRequirement]', '$_POST[jobDescription]', now() )";
if(mysql_query( $query)){
echo 'The job has been posted.<br>';
exit ();
}else{
echo 'The job could not be submitted. Because:'.mysql _error();
}
}#end of insert values if.
}#end of submit if...
// construct SQL statement
$sql =mysql_query("S ELECT * FROM company WHERE company_ID='{$_ SESSION['company_ID']}'");
$rows=@mysql_fe tch_array($sql)
?>[/PHP]
[HTML]<form name="act" method="post" action="jobPost .php">
<table width="600" border="0">
<tr>
<td colspan="3"><fo nt color="#000000" ><strong>COMPAN Y CONTACT INFORMATION</strong></font></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Company Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="companyNa me" type="text" maxlength="30" value="<? echo $rows['companyName'];?>"></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Contact Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="contactNa me" type="text" maxlength="30" value="<? echo $rows['contactName'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Email Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="emailAdd" type="text" maxlength="50" value="<? echo $rows['emailAdd'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Number</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="contactNu m" type="text" maxlength="11" value="<? echo $rows['contactNum'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><textarea name="contactAd d" cols="30" rows="3"><? echo $rows['contactAdd'];?></textarea> </textarea>
</td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<td colspan="3"><fo nt color="#000000" ><strong>JOB INFORMATION</strong></font></td>
<tr>
<td width="217"><fo nt color="#000000" >Job Title</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="jobTitle" type="text" maxlength="30"> </td>
</tr>
<tr>
<td><font color="#000000" >Job Type</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobType">
<option selected></option>
<option>Permane nt/Full Time</option>
<option>Tempora ry/Part Time</option>
<option>Interns hips</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Category</font> </td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobCatego ry">
<option selected></option>
<option>Account ing</option>
<option>Adverti sing</option>
<option>Agricul ture</option>
<option>Banking </option>
<option>Biotech nology</option>
<option>Chemica l Eng</option>
<option>Chemist ry</option>
<option>Clerica l/Admin</option>
<option>Custome r Service</option>
<option>Educati on</option>
<option>Electro nics Eng</option>
<option>Food Tech</option>
<option>Gener al Workers</option>
<option>Graphic s</option>
<option>Healthc are</option>
<option>Hotel/Food</option>
<option>Human Resources</option>
<option>IT/Computer</option>
<option>Journal ist/Editor</option>
<option>Manufac turing</option>
<option>Marketi ng</option>
<option>Mechani cal Eng</option>
<option>Media/Entertain</option>
<option>Persona l Care</option>
<option>Publish ing</option>
<option>Purchas ing</option>
<option>Quantit y Survey</option>
<option>Sales </option>
<option>Scien ce/Tech</option>
<option>Secreta rial</option>
<option>Socia l Services</option>
<option>Trainin g</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Position Level</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobPositi on">
<option selected></option>
<option>Senio r Manager</option>
<option>Manager </option>
<option>Senio r Executive</option>
<option>Junio r Executive</option>
<option>Non-Executive</option>
<option>Fresh/Entry Level</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Location</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobLocati on">
<option selected></option>
<option>Perli s</option>
<option>Penan g</option>
<option>Kedah </option>
<option>Perak </option>
<option>Kelanta n</option>
<option>Terengg anu</option>
<option>Pahan g</option>
<option>Selango r</option>
<option>Kuala Lumpur</option>
<option>Neger i Sembilan</option>
<option>Melak a</option>
<option>Johor </option>
<option>Labua n</option>
<option>Sabah </option>
<option>Sarawak </option>
</select></td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >Minimal Requirement</font></td>
</tr>
<tr>
<td height="75" colspan="3"> <textarea name="mRequirem ent" cols="66" rows="4"></textarea></td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<tr>
<td colspan="3">Job Description</td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >
<textarea name="jobDescri ption" cols="66" rows="4"></textarea>
</font></td>
</tr>
<tr>
<td colspan="2"><di v align="center">
<input name="Post Job" type="submit" id="Post Job" value="Post Job">
</div></td>
<td><div align="center">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
<p> </p>
</form>[/HTML]
3 2122
Below is my job post code, it cannot post into database... WHAT IS THE PROBLEM OF IT??
[PHP]<?php
mysql_select_db ("ums e-job portal", $conn) or die(mysql_error ());
?>[/PHP]
Are those 3 databases or is that the name of one database?
It's not good practice to have spaces in a databasename or in fieldnames for that matter.
Are those 3 databases or is that the name of one database?
It's not good practice to have spaces in a databasename or in fieldnames for that matter.
Is a name for 1 database...
i know, but i think the problem is not in there coz i have done others function which can work with this database name.. Thanks..
What is the error you see if you post or is there no error at all?
[PHP]$query = "INSERT INTO job values ( '', '$_SESSION[company_ID]', '$_SESSION[companyName]', '$_SESSION[contactName]' , '$_SESSION[emailAdd]', '$_SESSION[contactNum]', '$_SESSION[contactAdd]', '$_POST[jobTitle]', '$_POST[jobType]', '$_POST[jobCategory]', '$_POST[jobPosition]', '$_POST[jobLocation]', '$_POST[mRequirement]', '$_POST[jobDescription]', now() )";[/PHP]
are you sure that are all the fields in the table?
The following snippet is more secure and easier to maintain
[PHP]
$jobtitle = $_POST[jobTitle];
$jobtype = $_POST[jobType];
$jobcategory = $_POST[jobCategory];
$jobposition = $_POST[jobPosition];
$joblocation] = $_POST[jobLocation];
$mRequirement = $_POST[mRequirement];
$jobDescription = $_POST[jobDescription];
// add post variable checks
$query = 'INSERT INTO job (field,names) VALUES (post,variables ,and other)';
[/PHP]
If you do it like this the fieldnames and values must be equal in amount and you don't have to know how many other fields there are or where they are
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nomen Nescio |
last post by:
can anyone be so kind as to look at
http://www.mysolution.ws/HYPOCRITE.php
and let me know why it isn't passing the form data to
http://www.mysolution.ws/insertHYPOCRITES.php
for the most part, the scripts were created with
http://phpcodegenie.sourceforge.net/
|
by: srihari |
last post by:
Hai
I have installed db2 8.1 on linux machine. The current db2
users are instance user(db2inst1), fenced user(db2fenc1) and
db2as(administration server). To start using the database do I have
to create additional users or use the database as the instance owner
itself.
1) How do I create db2 users and test a connection from a db2 user.
2) If I have to create a new user , to which group do I have to make
|
by: Anthony England |
last post by:
(sorry for the likely repost, but it is still not showing on my news server
and after that much typing, I don't want to lose it)
I am considering general error handling routines and have written a sample
function to look up an ID in a table. The function returns True if it can
find the ID and create a recordset based on that ID, otherwise it returns
false.
**I am not looking for comments on the usefulness of this function - it is
|
by: Mark |
last post by:
i'm using an html form to submit comments to a database. the form is on
the same page where the comments are being displayed. if you hit
submit, your comment appears as it should, but then if you hit refresh
there is a duplicate post. how might i fix this?
|
by: Brano |
last post by:
HI all,
I am looking to post XML data to a particular page and also redirect to
the same page.
I have coded a WebReqest code in page0 that posts the XML to the page1
and then the page1 in its PageLoad event reads and parses the XML it
then saves the data it recieved to cookies. But using this technique
the code returns to the page0. I have then used
response.redirect(page1) but the cookies are lost...
| |
by: Challenge |
last post by:
Hi,
I got error, SQL1768N Unable to start HADR. Reason code = "7", when I
tried to start hadr primary database. Here are the hadr configuration
of my primary db:
HADR database role = STANDARD
HADR local host name (HADR_LOCAL_HOST) = testserver
HADR local service name (HADR_LOCAL_SVC) = 56000
HADR remote host name (HADR_REMOTE_HOST) = testserver
|
by: daJunkCollector |
last post by:
Hey,
I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen:
1. The form uploads to a database (the following code does this)
2. An e-mail notification is sent to a specified e-mail address. (I know this can be done in the database, but I would prefer it be contained within the ASP code for now, but cannot find...
|
by: ctrap |
last post by:
Hi Everyone,
Here's my situation: I'm making a website for an employment agency, there is a page where potential employees can visit and "pre-register". When the submit button is hit the information is supposed to be stored in a MySQL database. Number one, when I hit submit nothing happens. I have to manually execute the PHP script. When the PHP script is executed it inserts a blank record into the database and I get my Thank You...
|
by: Kurda Yon |
last post by:
Hi,
I have to decide which form-method I should use (GET or POST). I found
the following recomendation:
If the service associated with the processing of a form has side
effects (for example, modification of a database or subscription to a
service), the method should be POST. (http://www.cs.tut.fi/~jkorpela/
forms/methods.html).
However, later I did not find any convinced arguments why it should
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |