Hi,
I keep getting this error when filling out my form and calling process.php:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home3/waterfor/public_html/process.php on line 1

all I did was move around some of the variable names in the php code. It was working fine just a second before that.

Here is my php code:

<? $firstname=$_POST['fname']; $email=$_POST['email']; $lastname=$_POST['lname']; $address=$_POST['address1']; $addressii=$_POST['address2']; $state=$_POST['state']; $zip=$_POST['zip']; $phone=$_POST['phone1']; $phoneii=$_POST['phone2']; $advertising=$_POST['advertising']; $otherjobtype=$_POST['otherjobtype']; $jobtype=$_POST['jobtype']; $objective=$_POST['objective']; $resume=$_POST['resume']; $weekendavail=$_POST['weekend_shift']; $nightavail=$_POST['night_shift']; $pt_ft=$_POST['shift_preference']; mysql_connect("localhost", "admin", "pwd") or die(mysql_error()); mysql_select_db("app1") or die(mysql_error()); mysql_query("INSERT INTO `data` VALUES ('$firstname', '$lastname', '$email', '$address', '$addressii', '$state', '$zip', '$phone', '$phoneii', '$advertising', '$jobtype', '$otherjobtype', '$nightavail', '$weekendavail', '$pt_ft', '$objective', '$resume')"); Print "Thank you for your resume. Your information has been successfully added to the database and will be reviewed by a hiring representative.  Please continue to explore our site for more opportunities."; ?>

can anyone help?

try:

<?php
 mysql_connect("localhost", "admin", "pwd") or die(mysql_error()); 
 mysql_select_db("app1") or die(mysql_error()); 
 $firstname=mysql_real_escape_string($_POST['fname']); 
 $email=mysql_real_escape_string($_POST['email']); 
 $lastname=mysql_real_escape_string($_POST['lname']); 
 $address=mysql_real_escape_string($_POST['address1']); 
 $addressii=mysql_real_escape_string($_POST['address2']); 
 $state=mysql_real_escape_string($_POST['state']); 
 $zip=mysql_real_escape_string($_POST['zip']); 
 $phone=mysql_real_escape_string($_POST['phone1']); 
 $phoneii=mysql_real_escape_string($_POST['phone2']); 
 $advertising=mysql_real_escape_string($_POST['advertising']); 
 $otherjobtype=mysql_real_escape_string($_POST['otherjobtype']); 
 $jobtype=mysql_real_escape_string($_POST['jobtype']); 
 $objective=mysql_real_escape_string($_POST['objective']); 
 $resume=mysql_real_escape_string($_POST['resume']); 
 $weekendavail=mysql_real_escape_string($_POST['weekend_shift']); 
 $nightavail=mysql_real_escape_string($_POST['night_shift']); 
 $pt_ft=mysql_real_escape_string($_POST['shift_preference']); 
 mysql_query("INSERT INTO `data` VALUES ('$firstname', '$lastname', '$email', '$address', '$addressii', '$state', '$zip', '$phone', '$phoneii', '$advertising', '$jobtype', '$otherjobtype', '$nightavail', '$weekendavail', '$pt_ft', '$objective', '$resume')"); 
 print "Thank you for your resume. Your information has been successfully added to the database and will be reviewed by a hiring representative. Please continue to explore our site for more opportunities."; 
 ?>

thx for taking the time to help. I ended up re-typing the code I originally had from scratch and it worked! if i have any other questions though i will keep you in mind.
-l.


Hi,
I keep getting this error when filling out my form and calling process.php:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home3/waterfor/public_html/process.php on line 1

all I did was move around some of the variable names in the php code. It was working fine just a second before that.

Here is my php code:

<? $firstname=$_POST['fname']; $email=$_POST['email']; $lastname=$_POST['lname']; $address=$_POST['address1']; $addressii=$_POST['address2']; $state=$_POST['state']; $zip=$_POST['zip']; $phone=$_POST['phone1']; $phoneii=$_POST['phone2']; $advertising=$_POST['advertising']; $otherjobtype=$_POST['otherjobtype']; $jobtype=$_POST['jobtype']; $objective=$_POST['objective']; $resume=$_POST['resume']; $weekendavail=$_POST['weekend_shift']; $nightavail=$_POST['night_shift']; $pt_ft=$_POST['shift_preference']; mysql_connect("localhost", "admin", "pwd") or die(mysql_error()); mysql_select_db("app1") or die(mysql_error()); mysql_query("INSERT INTO `data` VALUES ('$firstname', '$lastname', '$email', '$address', '$addressii', '$state', '$zip', '$phone', '$phoneii', '$advertising', '$jobtype', '$otherjobtype', '$nightavail', '$weekendavail', '$pt_ft', '$objective', '$resume')"); Print "Thank you for your resume. Your information has been successfully added to the database and will be reviewed by a hiring representative.  Please continue to explore our site for more opportunities."; ?>

can anyone help?

i think this example may help you

create connection a other file coneection.php like this and include in this file


<?php
mysql_connect('localhost','admin','password') or die('Not connected to server');

mysql_select_db('db_name') or die("NOT selected DB");

?>


<?php

include('connect.php');

$fname = $_POST;
$email = $_POST;
$lname = $_POST;
$address1 = $_POST;

$query = "insert into table_name values('','$fname','$email','$lname','$address1')";

$result = mysql_query($query) or die('Error!');

if($result){
echo "Thank you for your resume.........";
echo " FNAME :- $fname<br>";
echo "E-MAIL :-$email<br>";
}
?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.