Displaying the code

hi , i want to install PHP and Appache to connect with oracle11g database . so currently i installed PHP 5.3.6 and apache_2.2.19-x86-openssl-1.0.0d , but m unable to execute phpinfo.php , its displaying the same code in page ( http://localhost/phpinfo.php)
<?php
phpinfo();
?>

please help me .

You need to make sure apache is setup to handle the PHP code (see http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml)

You will also need to install the Oracle Client (see this thread)

Thank you for solution .

I created one registration form as once form is filled and click on submit button it has to store in database . so i have written the code as shown below .

  &lt;?php

// list of jobs //
$jobList = array(‘Developer’,Database Administrator’,‘Business Systems Analyst’,‘Software Engineer’*/);
// sorting the jobs //
sort($jobList);

// list of countries //
$countryList = array(‘USA’,'UK,‘French Polynesia’,‘Gabon’,‘Gambia’,‘Georgia’,‘Germany’,);
// sorting the countries //
sort($countryList);
// looping the countries //

// jobs dropdown runtime //
$jdropdown = ‘’;

// country dropdown runtime //
$cdropdown = ‘’;

foreach($jobList as $job)
{
$jobName = ucwords($job);
$jdropdown .= “<option value=\”$jobName\“>$jobName</option>”;
}

foreach($countryList as $country)
{
$countryName = ucwords($country);
// storing country in dropdown //
$cdropdown .= “<option value=\”$countryName\“>$countryName</option>”;
}

$exp = ‘’;
for($i=1; $i<35; $i++)
{
$exp .= “<option>$i</option>”;
}
?>

<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<title> registration form</title>
<link href=“menu_scripts/styles.css” rel=“stylesheet” type=“text/css” />
<script src=“menu_scripts/ga.js” async=“” type=“text/javascript”></script>
<!–<script type=“text/javascript” src=“apply_files/select.js”></script>
<!–<script type=“text/javascript” src=“menu_scripts/rsv.js”></script>
<script type=“text/javascript”>
var rules = ;
rules.push(“required,form_of_address,Please enter your form of address”);
rules.push(“required,fromname,Please enter your first name.”);
rules.push(“required,lastname,Please enter your last name.”);
rules.push(“required,fromemail,Please enter your email address.”);
rules.push(“valid_email,fromemail,Please enter a valid email address.”);
</script>–>
</head>
<body>

  &lt;table width="585" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
	  &lt;tr&gt;
 &lt;td class="php_form_midbg"&gt;&lt;div class="mid_content2"&gt;&lt;form class="test" action="mail.php" method="post" enctype="multipart/form-data" name="form2" onsubmit="return rsv.validate(this, rules)"&gt;
	&lt;table width="560" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
   
   &lt;tbody&gt;&lt;tr&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;
       &lt;td colspan="3" class="mid_black_bold"&gt;Please fill thee form&lt;/td&gt;
      &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td colspan="3" class="body"&gt;&nbsp;&lt;/td&gt;
       &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td colspan="3" align="right" class="body"&gt;&lt;span style="color: rgb(255, 66, 0);"&gt;All Fields are mandatory&lt;/span&gt;&lt;/td&gt;
       &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td width="34%" align="right" class="body"&gt; Job Applying for&lt;/td&gt;
       &lt;td class="body" width="2%"&gt;:&lt;/td&gt;
       &lt;td style="font-size: 0.9em;" width="64%"&gt;
         &lt;span style="font-size: 0.9em;"&gt; &lt;select name="jobname" id="jobname" tabindex="1" onchange="showCD(this.value)"&gt;
           &lt;option selected="selected"&gt;Select&lt;/option&gt;
           &lt;?php echo $jdropdown; ?&gt;
           &lt;/select&gt;  &lt;/span&gt;
         
         &lt;div id="txtHint"&gt;&lt;/div&gt;    
         
         
        &lt;/td&gt;
      &lt;/tr&gt;    
     &lt;tr align="right"&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;
       &lt;td width="34%" align="right" class="body"&gt;Gender&lt;/td&gt;
       &lt;td class="body" width="2%"&gt;:&lt;/td&gt;
       &lt;td width="64%"&gt;&lt;select name="gender" tabindex="2" id="gender"&gt;
         &lt;option selected="selected" value=""&gt;Select&lt;/option&gt;
         &lt;option value="M"&gt;Male&lt;/option&gt;
         &lt;option value="F"&gt;Female&lt;/option&gt;

</select></td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> First Name</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”><input tabindex=“3” name=“firstname” type=“text”></td>
</tr>
<tr align=“right”><td height=“2” style=“height: 3px;”></td>
</tr>
<tr>
<td width=“34%” align=“right” class=“body”> Last Name</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”><input tabindex=“4” name=“lastname” type=“text”></td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> City</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”><input tabindex=“5” name=“strcity” class=“textfield” type=“text”></td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> State</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”><input name=“strstate” tabindex=“6” class=“textfield” type=“text”></td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> Country</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”>
<select name=“country” id=“country” tabindex=“7”>
<option value=“Select” selected=“selected”>Select</option>
<?php echo $cdropdown; ?>
</select>
</td>
</tr>

     &lt;tr align="right"&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;
       &lt;td width="34%" align="right" class="body"&gt; Phone No&lt;/td&gt;
       &lt;td class="body" width="2%"&gt;:&lt;/td&gt;
       &lt;td width="64%"&gt;&lt;input name="strno" tabindex="8" class="textfield" type="text"&gt;&lt;/td&gt;
      &lt;/tr&gt;
     &lt;tr align="right"&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;
       &lt;td width="34%" align="right" class="body"&gt; Email&lt;/td&gt;
       &lt;td class="body" width="2%"&gt;:&lt;/td&gt;
       &lt;td width="64%"&gt;&lt;input tabindex="9" name="fromemail" type="text"&gt;&lt;/td&gt;
      &lt;/tr&gt;
     &lt;tr align="right"&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;
       &lt;td width="34%" align="right" class="body"&gt; Total work experience in years&lt;/td&gt;
       &lt;td class="body" width="2%"&gt;:&lt;/td&gt;
       &lt;td width="64%"&gt;
         
		&lt;select name="totalexp" id="totalexp" tabindex="10"&gt;
			&lt;option selected="selected" value=" "&gt;Select&lt;/option&gt;
			&lt;?php echo $exp; ?&gt;
		&lt;/select&gt;

</td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> Comments</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”><textarea rows=“4” cols=“25” name=“strcomments” tabindex=“11”></textarea></td>
</tr>
<tr align=“right”><td style=“height: 3px;”></td></tr>
<tr>
<td width=“34%” align=“right” class=“body”> Resume</td>
<td class=“body” width=“2%”>:</td>
<td width=“64%”>

	   &lt;input name="filename" tabindex="12" type="file"&gt;&lt;/td&gt;
	   
      &lt;/tr&gt;
     &lt;tr&gt;&lt;td style="height: 3px;"&gt;&lt;/td&gt;&lt;/tr&gt;
       &lt;tr&gt;
         &lt;td colspan="3" align="center"&gt;&lt;table width="120" border="0"&gt;
           &lt;tr&gt;
             &lt;td&gt;&lt;input tabindex="13" name="btnSub2" value="Submit" type="submit" /&gt;&lt;/td&gt;
             &lt;td&gt;&lt;input tabindex="14" name="btnSub3" value="Cancel" type="submit" /&gt;&lt;/td&gt;
           &lt;/tr&gt;
         &lt;/table&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
        &lt;td colspan="3" align="center"&gt;&nbsp;&lt;/td&gt;
      &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td colspan="3" align="center"&gt;&nbsp;&lt;/td&gt;
       &lt;/tr&gt;
     
     &lt;/tbody&gt;
	&lt;/table&gt;
	
	
        &lt;/form&gt;&lt;/td&gt;
      &lt;/tr&gt;
	  
	  &lt;tr&gt;
	    &lt;td&gt;&nbsp;&lt;/td&gt;
	    &lt;/tr&gt;
	  &lt;/table&gt;
	  &lt;/body&gt;
	  &lt;/html&gt;

I have written the code to store the form info … to mysql database … so m getting error as unexpected variable . please help me .

<?php
function control($val,$min,$max,$ctype,$check)
{
if($check == ‘Y’)
{
// no spaces are allowed //
$secure = strip_tags(stripslashes(str_replace(’ ‘,’',(htmlentities($val)))));
}
else
{
// spaces are allowed //
$secure = strip_tags(stripslashes(trim(htmlentities($val))));
}

if($secure == '')
{
	echo "Enter ".$ctype;
	exit();
}
else if(strlen($secure) &lt; $min)
{
	echo "Enter Minimum ".$min." Characters ".$ctype;
	exit();
}
else if(strlen($secure) &gt; $max)
{
	echo "Enter Maximum ".$max." Characters ".$ctype;
	exit();
}
return $secure;

}
function userdata()
{
if(isset($_POST[‘btnSub2’]))
{
$job_name=control($_POST[‘jobname’],2,100,‘Job Applying For’,‘N’);
$gender=control($_POST[‘gender’],1,1,‘Gender’,‘Y’);
$first_name=control($_POST[‘firstname’],1,30,‘First Name’,‘N’);
$last_name=control($_POST[‘lastname’],1,30,‘Last Name’,‘N’);
$city=control($_POST[‘strcity’],2,50,‘City’,‘N’);
$state=control($_POST[‘strstate’],2,50,‘State’,‘N’);
$country=control($_POST[‘country’],2,50,‘Country’,‘N’);
$phone_mobile=control($_POST[‘strno’],8,15,‘Phone’,‘Y’);
$email=control($_POST[‘fromemail’],5,60,‘Email Address’,‘Y’);
$experience=control($_POST[‘totalexp’],1,2,‘Experience’,‘Y’);
$comment=control($_POST[‘strcomments’],10,500,‘Comment’,‘N’);

	$file_name = str_replace('_','',$_FILES['filename']['name']);
	$file_error = $_FILES['filename']['error'];
	
	if(!is_numeric($strno))
	{
		echo "Phone/Mobile Should be Numeric";
	} 
	else
	(
		$upload = false;
		$explode_file = explode('.',$file_name)
		$extension_supplied = $explode_file[count($explode_file) - 1];
		$extension_allowed = array('doc','docx');
		for($check=0; $check&lt;count($extension_allowed); $check++)
		{
			if($extension_supplied == $extension_allowed[$check])
			{
				$upload = true;
			}
		}
		// current timestamp //
		$timestamp = time();
		// temporary file name //
		$tmp_file_name = strtolower($fname)."_".strtolower($lname)."_".$timestamp."_".$file_name;
		// target directory //
		$target = "resume_coll/".$tmp_file_name;
		if($upload == true)
		{
			// connecting to database server //
			mysql_connect('db.domain.net','dbo3','glo');
			mysql_select_db('db1234566');
			$sql = "select email from tbl_user_details where email='$email'";
			if(mysql_num_rows(mysql_query($sql)) == 0)
			{
				$sql = "select phone_mobile from tbl_user_details where phone_mobile='$phone'";
				if(mysql_num_rows(mysql_query($sql)) == 0)
				{
					$sql = "insert into tbl_user_details values('','$job','$gender','$fname','$lname','$city','$state','$country',$phone,'$email',$experience,'$comment','$tmp_file_name',now())";
					if(mysql_query($sql))
					{
						if(is_uploaded_file($_FILES['filename']['tmp_name']))
						{
							if(move_uploaded_file($_FILES['filename']['tmp_name'],$target))
							{
								$message ="
								&lt;table&gt;
									&lt;tr&gt;&lt;th colspan=3 style='text-align:left;'&gt;User Details&lt;/th&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;First Name&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$fname&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Last Name&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$lname&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;City&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$city&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;State&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$state&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Country&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$country&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Phone/Mobile&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$phone&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Email&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$email&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Experience&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$experience Year(s)&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Comment&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;$comment&lt;/td&gt;&lt;/tr&gt;
									&lt;tr&gt;&lt;td&gt;Resume&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;&lt;a   href=http://mydomain.com/resume_coll/$tmp_file_name&gt;Download Now&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
								&lt;/table&gt;";
								$receiver = 'mydomain.com';
								$subject = "Resume Uploaded by ".ucwords($fname)." ".ucwords($lname);
								echo "in  resume upload";
								$headers = "From:".$email."\\r\

“.“Reply-To:”.$email.”\r
";
$headers .= "Content-type: text/html\r
";
//$message = htmlentities($message);
$mail = mail($receiver,$subject,$message,$headers);
if($mail)
{
echo "You will receive a confirmation E-mail with User Name and Password information ";
}
else
{
echo “Internet Connection Problem”;
}
}
else
{
echo “Resume not Transfer to Server”;
}
}
else
{
echo “Resume is not Uploaded.”;
}
}
}
else
{
echo “This Phone/Mobile is Already Existed”;
}
}
else
{
echo “This Email Already Uploaded Resume”;
}
}
else
{
echo “Invalid File Extension (<b>$extension_supplied</b>) to Upload.”;
}
}
}
}
function execute_code()
{
return userdata();
}
echo execute_code();
?>

Put your PHP code in [ php ] [/ php ] (without the spaces) and tell me what line number (or give the entire error message). Its’ too hard to read this, the way it is posted.

ok sorry, m unable to upload the file to database ( i want to store the file in the given target path) and now its giving error as ( Invalid File Extension () to Upload. )

<?php
function control($val,$min,$max,$ctype,$check)
{

}

function userdata()
{ if(isset($POST[‘btnSub2’]))
{$resume_file_name = str_replace('
‘,’',$FILES[‘filename’][‘name’]);
$file_error = $FILES[‘filename’][‘error’];
if(!is_numeric($strno))
{
echo “Phone/Mobile Should be Numeric”;
}
else
{
$upload = false;
echo “4Phone/Mobile Should be Numeric”;
$explode_file = explode(‘.’,$filename);
$extension_supplied = $explode_file[count($explode_file) - 1];
$extension_allowed = array(‘.doc’,‘.docx’);
for($check=0; $check<count($extension_allowed); $check++)
{if($extension_supplied == $extension_allowed[$check])
{$upload = true;}
}
// current timestamp //
$timestamp = time();
// temporary file name //
$tmp_file_name = strtolower($firstname)."
“.strtolower($lastname).”
“.$timestamp.”_".$filename;
// target directory //
$target = “abc/resume_coll/”.$tmp_file_name;
echo ".$target ,.$temp_file_name ";
if($upload == true)
{// connecting to database server //
$sql=mysql_connect(‘db42.db.com’,‘dbo4256938’,‘abcd123’);
if (!$sql)
{die('Connection failed: ’ . mysql_error());
}else
{ echo “Connection to MySQL server successful!”;
} $sql = mysql_select_db($db4256938);


if(is_uploaded_file($_FILES[‘filename’][‘tmp_name’]))
{
if(move_uploaded_file($_FILES[‘filename’][‘tmp_name’],$target))
{
$message ="
<table>-----<tr><td>Resume</td><td>:</td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name&gt;Download Now</a></td></tr>
----- </table>
$receiver = ‘abc@xyz.com’;
$subject = "Resume Uploaded by “.ucwords($firstname).” “.ucwords($lastname);
echo “in resume upload”;
$headers = “From:”.$email.”\r
“.“Reply-To:”.$email.”\r
";
$headers .= "Content-type: text/html\r
";
//$message = htmlentities($message);
$mail = mail($receiver,$subject,$message,$headers);
if($mail)
{
echo "You will receive a confirmation E-mail with User Name and Password information "; }
else
{
echo “Invalid File Extension (<b>$extension_supplied</b>) to Upload.”;
}function execute_code()
{
return userdata();
}
echo execute_code();
?>

I want to upload the file in target path but getting error as Invalid File Extension () to Upload. please help me .

Please re-post your code putting them in [ php ] and [/ php ] tags (but remove the extra spaces inside the tags, so it formats it so it is easier to read


$resume_file_name = str_replace('_','',$_FILES['filename']['name']);
$file_error = $_FILES['filename']['error'];
if(is_numeric($strno))
{echo "Phone/Mobile Should be Numeric";
} else{
$upload == false;
$explode_file = explode('.',$filename);
$extension_supplied = $explode_file[count($explode_file) - 1];
$extension_allowed = array('.doc','.docx');
for($check=0; $check<count($extension_allowed); $check++)
{if($extension_supplied == $extension_allowed[$check])
{$upload == true;
}} //$timestamp = time();
$tmp_file_name = strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
$target = "mine/resume_coll/".$tmp_file_name;		
if($upload == true)
{$sql=mysql_connect('db425.db.com','dbo425','abc123456');

hi, i am trying to upload the file in target path(folder) but m getting error as invalid File Extension to upload(). kindly help me .is this code correct .?


function control($val,$min,$max,$ctype,$check)
{
}function userdata() 
{ if(isset($_POST['btnSub2']))
{$resume_file_name = str_replace('_','',$_FILES['filename']['name']);
$file_error = $_FILES['filename']['error'];
if(!is_numeric($strno))
{echo "Phone/Mobile Should be Numeric";} 
else{$upload = false;
$explode_file = explode('.',$filename);
$extension_supplied = $explode_file[count($explode_file) - 1];
$extension_allowed = array('.doc','.docx');
for($check=0; $check<count($extension_allowed); $check++)
{if($extension_supplied == $extension_allowed[$check])
{$upload = true;}
}$timestamp = time();
$tmp_file_name = strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
$target = "abc/resume_coll/".$tmp_file_name;
echo ".$target ,.$temp_file_name ";
if($upload == true)
{ // connecting to database server //
$sql=mysql_connect('db42.db.com','dbo4256938','abcd123');
if (!$sql) 
{die('Connection failed: ' . mysql_error());
}else
{ echo "Connection to MySQL server successful!";
} $sql = mysql_select_db($db4256938);
---------
-------
if(is_uploaded_file($_FILES['filename']['tmp_name']))
{
if(move_uploaded_file($_FILES['filename']['tmp_name'],$target))
{$message ="
<table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name>Download Now</a></td></tr>
 </table>
$receiver = 'abc@xyz.com';
$subject = "Resume Uploaded by ".ucwords($firstname)." ".ucwords($lastname);
echo "in resume upload";
$headers = "From:".$email."\\r\
"."Reply-To:".$email."\\r\
";
$headers .= "Content-type: text/html\\r\
";
//$message = htmlentities($message);
$mail = mail($receiver,$subject,$message,$headers);
if($mail)
{echo "You will receive a confirmation E-mail with User Name and Password information "; }
else
{echo "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
}function execute_code()
{return userdata();
}echo execute_code();

Okay, do you see in your paste how the formatting just seems to go crazy after $message ="?

You forgot to close the ending " for your $message variable for one.

$message ="
<table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name>Download Now</a></td></tr>
 </table>

Should be

$message ="
<table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name>Download Now</a></td></tr>
 </table>";

Second, your error message isn’t based on any validation of the file extension but rather the validation of whether the e-mail was sent or not.

if($mail) // checks mail variable...
{
  echo "You will receive a confirmation E-mail with User Name and Password information "; 
}
else
{
  echo "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
}