CV generator

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
raydar22
Registered User
Posts: 1
Joined: Sun May 29, 2016 2:28 am

CV generator

Post by raydar22 »

Hi All, I am working on html form to PDF cv generator project. Everything is working except i can not add picture in my pdf. Anyone can help me please.


Code: Select all


<form action='' method='POST' enctype='multipart/form-data'>
<input type='file' name='userFile'><br>
<input type='submit' name='upload_btn' value='upload'>
</form>



<?php

$filename  = basename($_FILES['userFile']['name']);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
//$new     = $extension;
//$new=

move_uploaded_file($_FILES['userFile']['tmp_name'], "img/.{$extension}");

if(isset($_POST['submit'])){

    //collect form data
	$objective=$_POST['objective'];
    $lname = $_POST['lname'];
	$fname = $_POST['fname'];
    $email = $_POST['email'];
	
	$address = $_POST['address'];
	$city = $_POST['city'];
	$province = $_POST['province'];
	$country = $_POST['country'];
	$seducation = $_POST['seducation'];
	$ieducation = $_POST['ieducation'];
	$bachelor= $_POST['bachelor'];
	$syear1= $_POST['syear1'];
	$syear2= $_POST['syear2'];
	$byear1= $_POST['byear1'];
	$byear2= $_POST['byear2'];
	$iyear1= $_POST['iyear1'];
	$iyear2= $_POST['iyear2'];
	$sinstitute= $_POST['sinstitute'];
	$iinstitute= $_POST['iinstitute'];
	$binstitute= $_POST['binstitute'];
	$smarks= $_POST['smarks'];
	$bmarks= $_POST['bmarks'];
	$imarks= $_POST['imarks'];
	
	$project = $_POST['project'];
	$training = $_POST['training'];
	$awards = $_POST['awards'];
	$skills=$_POST['skills'];
	$cell=$_POST['cell'];



  //check name is set
    if($fname ==''){
        $error[] = 'Name is required';
    }
	
if ($syear1 > $syear2) {
  $error[]= ' Secondary School Start date must be less than end date';
 
}
if ($iyear1 > $iyear2) {
  $error[]= ' intermediate Start date must be less than end date';
 
}
if ($byear1 > $byear2) {
  $error[]= ' University Start date must be less than end date';
 
}
    //check for a valid email address
    if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
         $error[] = 'Please enter a valid email address';
    }

    //if no errors carry on
    if(!isset($error)){

        //create html of the data
        ob_start();
        ?>
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="style.css">

  <link rel="stylesheet" type="text/css" media="all" href="responsive.css">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

 
		</head>
		
		<body id="top">
<div id="cv" class="instaFade">
	<div class="mainDetails">
		<div id="headshot" class="quickFade">
		<img src="img/"." <?echo $_FILES['userFile']['tmp_name']; ?>">
		</div>
		
		<div id="name">
			<h1 class="quickFade delayTwo"><?php echo $fname,' ',$lname;?> </h1>
			
		</div>
		
<div id="contactDetails" class="quickFade delayFour">
			<ul>
				<li>e: <?php echo $email;?></a></li>
				<li>m: <?php echo $cell;?></li>
				<li>A: <?php echo $address,' ', $city, ' ', $province, ' ', $country;?> </li>
			</ul>
		</div>
		<div class="clear"></div>
	</div>		

	<div id="mainArea" class="quickFade delayFive">
		<section>
			<article>
				<div class="sectionTitle">
					<h1>Objective</h1>
				</div>
				
				<div class="sectionContent">
					<p><?php echo $objective;?></p>
					<p><img src="img/student1.jpg" > </p>
				</div>
			</article>
			<div class="clear"></div>
		</section>
		
     <section>
			<div class="sectionTitle">
				<h1>Education</h1>
			</div>
			
			<div class="sectionContent">
				<article>
					<h2><?php echo $sinstitute;?></h2>
					<p class="subDetails"><?php echo $syear1, '-', $syear2;?></p>
					<p class="subDetails">Marks:<?php echo $smarks;?></p>
					
					
				</article>
				
				<article>
					<h2><?php echo $iinstitute;?></h2>
					<p class="subDetails"><?php echo $iyear1, '-', $iyear2;?></p>
					<p class="subDetails">Marks:<?php echo $imarks;?></p>
					
				</article>
				
				<article>
					<h2><?php echo $binstitute;?></h2>
					<p class="subDetails"><?php echo $byear1, '-', $byear2;?></p>
					<p class="subDetails">Marks:<?php echo $bmarks;?></p>
				</article>
			</div>
			<div class="clear"></div>
		</section>   
      <section>
			<div class="sectionTitle">
				<h1>Final Year Project Title</h1>
				<p class="subDetails"><?php echo $project;?></p>
			</div>
            
           
<section>
			<div class="sectionTitle">
				<h1>Key Skills & Development</h1>
			<p><?php echo $training;?></p>
			</div>
<div class="clear"></div>
		</section>
            
	<section>
			<div class="sectionTitle">
				<h1>AWARDS</h1>
			<p><?php echo $awards;?></p>
			</div>
<div class="clear"></div>
		</section>		
            
	<section>
			<div class="sectionTitle">
				<h1>DEVELOPMENT & TECHNICAL SKILLS</h1>
			<p><?php echo $skills;?></p>
			</div>
<div class="clear"></div>
		</section>		

        <?php 
        $body = ob_get_clean();

        $body = iconv("UTF-8","UTF-8//IGNORE",$body);

        include("mpdf/mpdf.php");
        $mpdf=new \mPDF('c','A4','','' , 0, 0, 0, 0, 0, 0); 

        //write html to PDF
        $mpdf->WriteHTML($body);
 
        //output pdf
        $mpdf->Output('demo.pdf','D');

        //save to server
        //$mpdf->Output("mydata.pdf",'F');



    }
}

//if their are errors display them
if(isset($error)){
    foreach($error as $error){
        echo "<p style='color:#ff0000'>$error</p>";
    }
}


?> 



<form action='' method='post'>
<div id="wrapping" class="clearfix">
<section id="aligned">

<p><textarea name="objective" id="objective" placeholder="Career objective..." tabindex="5" class="txtblock" rows="14" cols="50" ></textarea></p>







<input type="text" name="lname" id="name" placeholder="Your Last name" autocomplete="on" tabindex="1" class="txtinput"><br/>
<br/>
<input type="text" name="fname" id="name2" placeholder="Your First name" autocomplete="on" tabindex="1" class="txtinput"> <br />
<br />

<input type="email" name="email" id="email" placeholder="Your e-mail address" autocomplete="on" tabindex="2" class="txtinput"><br />
<br />
<input type="text" name="cell" id="cell" placeholder="mobile number" autocomplete="on" tabindex="1" class="txtinput"><br/>
<br />
<input type="text" name="address" id="address" placeholder="Your street Name and Number" autocomplete="on" tabindex="1" class="txtinput" required><br />
<br />

<input type="text" name="city" id="city" placeholder="City" autocomplete="on" tabindex="1" class="txtinput" required>><br />
<br />
<input type="text" name="province" id="province" placeholder="Province" autocomplete="on" tabindex="1" class="txtinput" required>><br />
<br />
<input type="text" name="country" id="country" placeholder="Your Country Name" autocomplete="on" tabindex="1" class="txtinput" required>><br />
<br />


<p><label>Education Background</label><br>
<section name="seducation">
				
					<select id="seducation" name="seducation" tabindex="6" class="selmenu">
  						<option value="secondary">Secondary</option>
  <option value="olevel">OLevel</option>
					</select>
				
  <label>Year</label><select id="syear" name="syear1" tabindex="6" class="selmenu">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<label> TO</label><select id="syear2" name="syear2" tabindex="6" class="selmenu">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<input type='text' name='sinstitute' value='' placeholder="Institute Name" autocomplete="on" tabindex="1" class="txtinput">
<input type='text' name='smarks' value='' placeholder="Marks" autocomplete="on" tabindex="1" class="txtinput">

<p><select name='ieducation'  tabindex="6" class="selmenu">
  <option value="Intermediate">Intermediate</option>
    </select>
  <label>Year<select id="year" name="iyear1"  tabindex="6" class="selmenu">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<label> TO</label><select id="year2" name="iyear2"  tabindex="6" class="selmenu">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<input type='text' name='iinstitute' value='' placeholder="Institute Name" autocomplete="on" tabindex="1" class="txtinput">
<input type='text' name='imarks' value='' placeholder="Marks" autocomplete="on" tabindex="1" class="txtinput">
</p>
<select name='bachelor' tabindex="6" class="selmenu">
  <option value="bachelor">Bachelor</option>
    </select>
  <label>Year</label><select id="byear" name="byear1" tabindex="6" class="selmenu">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<label> TO</label><select id="byear2" name="byear2">
  <?php
  for($i = 1900; $i < date("Y")+1; $i++){
	  echo '<option value="'.$i.'">'.$i.'</option>';
  }
  ?>
</select>
<input type='text' name='binstitute' value='' placeholder="Institute Name" autocomplete="on" tabindex="1" class="txtinput">
<input type='text' name='bmarks' value='' placeholder="Marks" autocomplete="on" tabindex="1" class="txtinput">


</section>
<p>
</p>
<br />
<br />
<Section>
<p><input type='text' name='project' value='' placeholder="Final Year Project Name" autocomplete="on" tabindex="1" class="txtinput"> </p><br />
<br />
<textarea name="training" id="training" placeholder="Training/Workshop/Internships ..." tabindex="5" class="txtblock" rows="14" cols="50" ></textarea> <br />
<br />
<textarea name="awards" id="awards" placeholder="Honors & AWards" tabindex="5" class="txtblock" rows="14" cols="50" ></textarea> <br />
<br />
<p><textarea rows="14" cols="50" name='skills' placeholder="Development & Technical Skills" tabindex="5" class="txtblock" >
</textarea></p>

</section>



<section>
<p><input type='submit' name='submit' value='Submit'></p> 
</section>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3753241-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</form>
</section>
</body>
</html>


User avatar
darcie
Community Team Member
Community Team Member
Posts: 5543
Joined: Thu Jul 27, 2006 9:52 am
Location: Davis, California
Name: Darcie Griffin
Contact:

Re: CV generator

Post by darcie »

Hi and welcome! This question appears to be related to PHP, the programming language, but not phpBB, the forum software, from what I can see. This forum is strictly related to phpBB. Is your question related to that?
phpBB on Facebook | Site Rules | Former Community Team leader
Locked

Return to “[3.1.x] Support Forum”