Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
This is my code i am getting some error can anyone help me out in this matter.

PHP
<?php
session_start();
$job_title='';
$first_name='';
$last_name='';
$email='';
$current_company='';
$mobile='';
//$resume='';


if($_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code']) )
 {
if( isset($_POST['Submit'])) {

$job_title=$_POST['job_title'];
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email=$_POST['email'];
$current_company=$_POST['current_company'];
$mobile=$_POST['mobile'];
//$resume=$_FILES['resume'];
//$resume=($_FILES['resume']['first_name']);


 $date=date("Y-m-d"." "."h:i:s");
 $date1=date("Ymdhis");
 //This is the directory where images will be saved
 $docc=($_FILES['resume']['name']);
 $doc =$date1.str_replace(' ','',$docc);
 $target = "resumes/";
 $target = $target.basename($doc);

 //This gets all the other information from the form
 $name=$_POST['first_name'];
//Tells you if its all ok

if(move_uploaded_file($_FILES['resume']['tmp_name'],$target))
 {
 echo "The file ". basename( $_FILES['resume']['first_name']). " has been uploaded, and your information has been added to the directory".$date." ".$date1."<br/>";
 }
 }
else
{
echo "sorry no data uploaded";
}
}
else{echo "No data found Pls reselect";}
?>


XML
<form action="<?php echo $_SERVER['PHP_SELF'];?>" name="WebToLeadForm" method="post" id="WebToLeadForm" onsubmit="javascript: return form_validation();" >
               <tr>
                 <td colspan="2" class="required" style="height: 14px"><strong>Please fill this form:</strong>&nbsp;<span class="required" style="color:#64a34f;">* marked Fields are compulsory.</span></td>
               </tr>
               <tr>
                 <td >Job Title<span class="required" style="color:#64a34f;">*</span>: </td>
                 <td ><span sugar="slot">
                   <input id="job_title" name="job_title" type="text" style="width:150px;" value="<?php echo htmlentities($job_title) ?>" />
                   </span> </td>
               </tr>
               <tr>
                 <td width="48%" >First Name<span class="required" style="color:#64a34f;">*</span>:</td>
                 <td width="52%" ><input id="first_name" name="first_name" type="text" style="width:150px;" value="<?php echo htmlentities($first_name) ?>" />
                 </td>
               </tr>
               <tr>
                 <td width="48%" >Last Name<span class="required" style="color:#64a34f;">*</span>:</td>
                 <td width="52%" ><input id="last_name" name="last_name" type="text" style="width:150px;" value="<?php echo htmlentities($last_name)?>" />
                 </td>
               </tr>
               <tr>
                 <td >Email Address<span class="required" style="color:#64a34f;">*</span> : </td>
                 <td ><input id="email" name="email" type="text" style="width:150px;" value="<?php echo htmlentities($email) ?>" />
                 </td>
               </tr>
               <tr>
                 <td ><span sugar="slot">Current Company Name</span> <span class="required" style="color:#64a34f;">*</span>: </td>
                 <td ><span sugar="slot">
                   <input id="current_company" name="current_company" type="text" style="width:150px;" value="<?php echo htmlentities($current_company) ?>"/>
                   </span> </td>
               </tr>
               <tr>
                 <td >Contact Number<span class="required" style="color:#64a34f;">*</span>: </td>
                 <td ><span sugar="slot">
                   <input id="mobile" name="mobile" type="text" style="width:150px;" value="<?php echo htmlentities($mobile) ?>" />
                   </span> </td>
               </tr>
               <tr>
                 <td >Upload your Resume <span class="required" style="color:#64a34f;">*</span>:</td>
                 <td valign="top">
                 <input name="resume" id="resume"  type="file" style="width:180px;"/>
                 </td>
                  </tr>
                <tr>
                     <td height="30" valign="top" >&nbsp;</td>
                    <td valign="top"><img id="imgid" name="img" src="CaptchaSecurityImages.php?width=100&height=40&characters=5" />                                  </td>
                 </tr>
                 <tr>
                     <td height="30" valign="top" ><small>Can't read the image?</small> </td>
                     <td valign="top">click <a href='javascript: refreshCaptcha();'><small>here</small></a><small>&nbsp;to refresh</small>                       </td>
                  </tr>
                 <tr>
                     <td height="30" valign="top" >Security Code:<span class="required" style="color:#93B928;">*</span></td>
                     <td valign="top"><input id="security_code" name="security_code" type="text" style="width:100px;"/></td>
                  </tr>

               <tr>
                 <td height="30" valign="top" >&nbsp;</td>
                 <td valign="top"><input class="button" name="Submit" value="Send" type="submit" /></td>
               </tr>
             </form>
           </table>



Error i am getting
1-Undefined index: resume in C:\wamp\www\MySQL\careers.php on line 29
2-Undefined index: resume in C:\wamp\www\MySQL\careers.php on line 38

thanks in advance
Posted
Updated 13-Sep-19 4:22am

1 solution

Looks like line pointing error are:
PHP
$docc=($_FILES['resume']['name']);
AND 
if(move_uploaded_file($_FILES['resume']['tmp_name'],$target))


Based on error, accessing $_FILES using ['resume'] is incorrect and no such index exists. Check it and correct it. (May be that directory does not exists?)
 
Share this answer
 
Comments
[no name] 18-Jul-12 23:59pm    
hi sandeep,
thats what i saying but you can see the resume file i have taken then why error coming.

tahnks
mohanjack 27-Aug-13 0:05am    
how to get captcha
Sandeep Mewara 19-Jul-12 1:32am    
Well, code says it's not present. DEBUG and see when does that actually exists...
[no name] 19-Jul-12 1:46am    
i have sent you the whole code, you can check that, this is present in the code.
Sandeep Mewara 19-Jul-12 1:52am    
Sent me? what sent me...

Further, I don't have time to go through whole of your code. Sorry!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900