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 message. I realize my dilemma is pretty basic and has probably been answered several times, I have searched the forum and tried different pieces code but nothing seems to work for me. I've tried code using $_POST in front of the variables but it just leads to more errors and confusion. I'm using PHP5 and MySQL Server 5.0. Here is my HTML code:
<code>
<form action="AddAppl icant.php" method="POST">
<font face="Times New Roman", size="3", color="151B8D">
<b>*First Name: <input type="text" name="firstname " id="firstname" >
*Last Name: <input type="text" name="lastname" id="lastname">< br><Br>
*Address: <input type="text" name="address" id="address" size="25">
*City: <input type="text" name="city" id="city"><br>< br>
*State: <input type="text" name="state" id="state" size="1">
*Zip Code: <input type="text" name="zipcode" id="zipcode" size="5">
*Phone: <input type="text" name="phono" id="phono"><br> <br>
Alternate Phone: <input type="text" name="altphono" id="altphono">
E-mail: <input type="text" name="email" id="email"><br> <br>
*Objective</b><br>Provide a brief description of the type of employment you are seeking.<br>
<Textarea name="objective " rows="5" cols="50" id="objective"> </textarea><br><b r>
<b>*Education </b><br>Select One<br>
<select name="education " "id="education" >
<option value="High School Diploma">High School Diploma</option>
<option value="College Credits">Colleg e Credits</option>
<option value="Associat es Degree">Associa tes Degree</option>
<option value="Bachelor s Degree">Bachelo rs Degree</option>
<option value="Past Grad Creidts">Past Grad Credits</option>
<option value="Masters Degree">Masters Degree</option>
<option value="Other">O ther</option></select><br><br>
<b>Additional Certifications, Seminars, & Licenses<br>
<Textarea name="certnsems " rows="3" cols="50" "id="certnsems" ></textarea><br><b r>
*Work Experience</b><br>
Describe your work experience or copy and paste your resume.
<Textarea name="workexp" rows="7" cols="50" id="workexp"></textarea><br><b r>
<center><inpu t type="submit" name="submit" value="Submit"> </center><br><br>
</form>
</code>
Here is my PHP code:
<code>
<body>
<?php
$host="localhos t";
$username="root ";
$password="363m arket";
$db_name="svesa pplicants";
$tbl_name="appl icants";
global
$firstname, $lastname, $address, $city, $state, $zipcode, $phono, $altphono, $email, $objective, $education, $certnsems, $workexp;
mysql_connect(" $host", "$username" , "$password" )or die("Cannot Connect to Server");
mysql_select_db ("$db_name") or die("cannot select DB");
$sql="INSERT INTO $tbl_name(first name, lastname, address, city, state, zipcode, phono, altphono, email, objective, education, certnsems, workexp)
VALUES('$firstn ame', '$lastname', '$address', '$city', '$state', '$zipcode', '$phono', '$altphono', '$email', '$objective', '$education', '$certnsems', '$workexp')";
$result=mysql_q uery($sql);
if($result){
echo "Thank You";
}
else {
echo "ERROR";
}
mysql_close();
?>
</body><html>
</code>
As you can tell I'm not an advanced programmer, I would truly appreciate any help or suggestions. :) Thanks in advance. ctrap
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 message. I realize my dilemma is pretty basic and has probably been answered several times, I have searched the forum and tried different pieces code but nothing seems to work for me. I've tried code using $_POST in front of the variables but it just leads to more errors and confusion. I'm using PHP5 and MySQL Server 5.0. Here is my HTML code:
<code>
<form action="AddAppl icant.php" method="POST">
<font face="Times New Roman", size="3", color="151B8D">
<b>*First Name: <input type="text" name="firstname " id="firstname" >
*Last Name: <input type="text" name="lastname" id="lastname">< br><Br>
*Address: <input type="text" name="address" id="address" size="25">
*City: <input type="text" name="city" id="city"><br>< br>
*State: <input type="text" name="state" id="state" size="1">
*Zip Code: <input type="text" name="zipcode" id="zipcode" size="5">
*Phone: <input type="text" name="phono" id="phono"><br> <br>
Alternate Phone: <input type="text" name="altphono" id="altphono">
E-mail: <input type="text" name="email" id="email"><br> <br>
*Objective</b><br>Provide a brief description of the type of employment you are seeking.<br>
<Textarea name="objective " rows="5" cols="50" id="objective"> </textarea><br><b r>
<b>*Education </b><br>Select One<br>
<select name="education " "id="education" >
<option value="High School Diploma">High School Diploma</option>
<option value="College Credits">Colleg e Credits</option>
<option value="Associat es Degree">Associa tes Degree</option>
<option value="Bachelor s Degree">Bachelo rs Degree</option>
<option value="Past Grad Creidts">Past Grad Credits</option>
<option value="Masters Degree">Masters Degree</option>
<option value="Other">O ther</option></select><br><br>
<b>Additional Certifications, Seminars, & Licenses<br>
<Textarea name="certnsems " rows="3" cols="50" "id="certnsems" ></textarea><br><b r>
*Work Experience</b><br>
Describe your work experience or copy and paste your resume.
<Textarea name="workexp" rows="7" cols="50" id="workexp"></textarea><br><b r>
<center><inpu t type="submit" name="submit" value="Submit"> </center><br><br>
</form>
</code>
Here is my PHP code:
<code>
<body>
<?php
$host="localhos t";
$username="root ";
$password="363m arket";
$db_name="svesa pplicants";
$tbl_name="appl icants";
global
$firstname, $lastname, $address, $city, $state, $zipcode, $phono, $altphono, $email, $objective, $education, $certnsems, $workexp;
mysql_connect(" $host", "$username" , "$password" )or die("Cannot Connect to Server");
mysql_select_db ("$db_name") or die("cannot select DB");
$sql="INSERT INTO $tbl_name(first name, lastname, address, city, state, zipcode, phono, altphono, email, objective, education, certnsems, workexp)
VALUES('$firstn ame', '$lastname', '$address', '$city', '$state', '$zipcode', '$phono', '$altphono', '$email', '$objective', '$education', '$certnsems', '$workexp')";
$result=mysql_q uery($sql);
if($result){
echo "Thank You";
}
else {
echo "ERROR";
}
mysql_close();
?>
</body><html>
</code>
As you can tell I'm not an advanced programmer, I would truly appreciate any help or suggestions. :) Thanks in advance. ctrap
Comment