Jump to content

Recommended Posts

Dear all, 

I'm newbie to PHP and to the site, I'm trying to make an online CV form to be filled as well to attach picture and document file to the form, and then when the user submit it a copy of the form to be sent to my email and another copy to Mysql database on my 000website.com

I've attached my form, but I'm not sure about the code specially :

- The date filed (to be in format dd/mm/yyyy for specific period)

- The Radio button,to display the checked answer only in the Database

- I'm not aware how to make the attach file and attach photo option

- Try to make verification code to be sent first to the user's email before press submit

 

if this solved, I will need help later with configuring the mysql file.

 

Thank you all in advance, hope I can get some help

formcode.php

Link to comment
https://forums.phpfreaks.com/topic/303889-cv-form-with-radio-and-attach/
Share on other sites

I've sent the form which I made with all the codes I understand, but I don't know how to make the date filed to be dd/mm/yyyy, in my form it looks like empty box only not for date, 

regarding the radio button, is my codes correct ? it will not show the checked answer in the database??

<?php
if( $_POST )
{
  $con = mysql_connect("localhost","id142307_*****","*****");
if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }

  mysql_select_db("id142307_*****", $con);

  $users_Full name= $_POST['Full name'];
  $users_Date of birth= $_POST['Date of birth'];
  $users_Visa Type= $_POST['Visa Type'];
  $users_Visa validation= $_POST['Visa validation'];
  $users_Graduation= $_POST['Graduation'];
  $users_Graduation year= $_POST['Graduation year'];
  $users_Mobile Number= $_POST['Mobile Number'];
  $users_Email Address= $_POST['Email Address'];
  $users_Address in Kuwait= $_POST['Address in Kuwait'];
  $users_Driving License= $_POST['Driving License'];
  $users_Employment status= $_POST['Employment status'];
  $users_Fields of expertise= $_POST['Fields of expertise'];
  $users_Last / Current Title= $_POST['Last / Current Title'];
  $users_Expected Salary KD= $_POST['Expected Salary KD'];
  $users_Arabic level= $_POST['Arabic level'];
  $users_English level= $_POST['English level'];
  $users_MS Outlook= $_POST['MS Outlook'];
  $users_MS Excel= $_POST['MS Excel'];
  $users_MS Access= $_POST['MS Access'];
  $users_MS Word= $_POST['MS Word'];

$users_Full name=mysql_real_escape_string($users_Full name);
$users_Date of birth=mysql_real_escape_string($users_Date of birth);
$users_Visa Type=mysql_real_escape_string($users_Visa Type);
$users_Visa validation=mysql_real_escape_string($users_Visa validation);
$users_Graduation=mysql_real_escape_string($users_Graduation);
$users_Graduation year=mysql_real_escape_string($users_Graduation year);
$users_Mobile Number=mysql_real_escape_string($users_Mobile Number);
$users_Email Address=mysql_real_escape_string($users_Email Address);
$users_Address in Kuwait=mysql_real_escape_string($users_Address in Kuwait);
$users_Driving License=mysql_real_escape_string($users_Driving License);
$users_Employment status=mysql_real_escape_string($users_Employment status);
$users_Fields of expertise=mysql_real_escape_string($users_Fields of expertise);
$users_Last / Current Title=mysql_real_escape_string($users_Last / Current Title);
$users_Expected Salary KD=mysql_real_escape_string($users_Expected Salary KD);
$users_Arabic level=mysql_real_escape_string($users_Arabic level);
$users_English level=mysql_real_escape_string($users_English level);
$users_MS Outlook=mysql_real_escape_string($users_MS Outlook);
$users_MS Excel=mysql_real_escape_string($users_MS Excel);
$users_MS Access=mysql_real_escape_string($users_MS Access);
$users_MS Word=mysql_real_escape_string($users_MS Word);

$articleid = $_GET['id'];

if( ! is_numeric($articleid) ) {

die('invalid article id'); }
  $query = "
INSERT INTO `NewForm` (`ID`, `Full name`, `Date of birth`, `Visa Type`, `Visa validation`, `Graduation`, `Graduation year`, `Mobile Number`, `Email Address`, `Address in Kuwait`, `Driving License`, `Employment status`, `Fields of expertise`, `Last / Current Title`, `Expected Salary KD`, `Arabic level`, `English level`, `MS Outlook`, `MS Excel`, `MS Access`, `MS Word`, `Time Stamp`, `ArticleID`);
$return = mysql_query($query);

  echo "<h2>Thank you</h2>";

  mysql_close($con);
}
?>

the code above is the manage_CVs.php, to get the form sent to my SQL database

 

the code below is the formcode.php, to be filed by the guest in page1.php

<form method='post'>
<strong>Full name</label></strong>

<div class="input-group"><span class="input-group-addon left"><i class="glyphicon glyphicon-user"></i> </span>
<input type="text" class="form-control" id="f1" name="f1" value=""    
    data-rule-required="true"  />
</div>
  
</div>

<div class="form-group f4 required" data-fid="f4">
  <label class="control-label" for="f4"><strong>Date of birth</strong></label>

<div class="input-group date">
<input type="text" class="form-control datepicker" id="f4" name="f4" value=""   
    data-rule-required="true"  
  data-datepicker-format="dd/mm/yyyy"
  data-datepicker-startDate="-18"
  data-datepicker-startView="1"
  data-datepicker-minViewMode="2"
  data-datepicker-multidate="false"
  data-datepicker-multidateSeparator="/" />
<span class="input-group-addon right"><i class="glyphicon glyphicon-th"></i> </span></div>
  
</div>


<div class="form-group f6 required col-3" data-fid="f6">
  <label class="control-label" for="f6"><strong>Visa Type</strong></label>

<div class="Radio">
  	<input  id="f6_1" name="f6[]"  type="Radio" value="Art. 22" 
    data-rule-required="true"  >
  	<label  for="f6_1">
  		Art. 22
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f6_2" name="f6[]"  type="Radio" value="Art. 18"  >
  	<label  for="f6_2">
  		Art. 18
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f6_3" name="f6[]"  type="Radio" value="Art. 17"  >
  	<label  for="f6_3">
  		Art. 17
  	</label>
  </div>

  
</div>

<div class="form-group f7 required col-2" data-fid="f7">
  <label class="control-label" for="f7"><strong>Visa validation</strong></label>

<div class="Radio">
  	<input  id="f7_1" name="f7[]"  type="Radio" value="Valid" 
    data-rule-required="true"  >
  	<label  for="f7_1">
  		Valid
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f7_2" name="f7[]"  type="Radio" value="Expired"  >
  	<label  for="f7_2">
  		Expired
  	</label>
  </div>

  
</div>




<div class="form-group f8 required" data-fid="f8">
  <label class="control-label" for="f8"><strong>Graduation</strong></label>


	<strong>


<input class="form-control" id="f8" name="f8" max="2011-12-31" min="2015-01-02" value=""    
    data-rule-required="true" dir="ltr"  /></strong>
  
</div>


<div class="form-group f9 required" data-fid="f9">
  <label class="control-label" for="f9"><strong>Graduation year</strong></label>

<div class="input-group date">
<input type="text" class="form-control datepicker" id="f9" name="f9" value=""   
    data-rule-required="true"  
  data-datepicker-format="dd/mm/yyyy"
  data-datepicker-startDate="-18"
  data-datepicker-startView="1"
  data-datepicker-minViewMode="2"
  data-datepicker-multidateSeparator="/" />
<span class="input-group-addon right"><i class="glyphicon glyphicon-th"></i> </span></div>
  
</div>




<div class="form-group f12 required" data-fid="f12">
  <label class="control-label" for="f12"><strong>Mobile Number</strong></label>


<input type="text" class="form-control" id="f12" name="f12" value="" maxlength="8"   
    data-rule-required="true" 
    data-rule-minlength="8" data-msg-minlength="Please enter at least {8} characters."  
    data-rule-maxlength="8" data-msg-maxlength="Please enter no more than {8} characters."   
    data-mask="#" />

 
</div>

<div class="form-group f13 required" data-fid="f13">
  <label class="control-label" for="f13"><strong>Email Address</strong></label>


<input type="email" class="form-control" id="f13" name="f13" value=""   
    data-rule-email="true" 
    data-rule-required="true"  />

  
</div>




<div class="form-group f14 required" data-fid="f14">
  <label class="control-label" for="f14"><strong>Address in Kuwait</strong></label>


<input type="text" class="form-control" id="f14" name="f14" value=""    
    data-rule-required="true"  />


  
</div>




<div class="form-group f15 required col-2" data-fid="f15">
  <label class="control-label" for="f15"><strong>Driving License</strong></label>

<div class="Radio">
  	<input  id="f15_1" name="f15[]"  type="Radio" value="Yes" 
    data-rule-required="true"  >
  	<label  for="f15_1">
  		Yes
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f15_2" name="f15[]"  type="Radio" value="No"  >
  	<label  for="f15_2">
  		No
  	</label>
  </div>

  
</div>




<div class="form-group f34 " data-fid="f34">
  <label class="control-label" for="f34">Untitled</label>


  
</div>




<div class="form-group f16 required col-2" data-fid="f16">
  <label class="control-label" for="f16"><strong>Employment status</strong></label>

<div class="Radio">
  	<input  id="f16_1" name="f16[]"  type="Radio" value="Employee" 
    data-rule-required="true"  >
  	<label  for="f16_1">
  		Employee
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f16_2" name="f16[]"  type="Radio" value="Unemployed"  >
  	<label  for="f16_2">
  		Unemployed
  	</label>
  </div>

  
</div>




<div class="form-group f29 required" data-fid="f29">
  <label class="control-label" for="f29">Fields of expertise</label>


<textarea class="form-control" id="f29" name="f29" rows="3"   
    data-rule-required="true" ></textarea>

  
</div>




<div class="form-group f17 required" data-fid="f17">
  <label class="control-label" for="f17">Last / Current Title</label>


<textarea class="form-control" id="f17" name="f17" rows="3"   
    data-rule-required="true" ></textarea>

  
</div>




<div class="form-group f18 required" data-fid="f18">
  <label class="control-label" for="f18">Expected Salary KD</label>


<input type="text" class="form-control" id="f18" name="f18" value=""    
    data-rule-required="true"  
    data-mask="S" />


  
</div>




<div class="form-group f33 " data-fid="f33">
  <label class="control-label" for="f33">Untitled</label>


  
</div>




<div class="form-group f19 required col-3" data-fid="f19">
  <label class="control-label" for="f19">Arabic level</label>

<div class="Radio">
  	<input  id="f19_1" name="f19[]"  type="Radio" value="Beginner" 
    data-rule-required="true"  >
  	<label  for="f19_1">
  		Beginner
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f19_2" name="f19[]"  type="Radio" value="Elementary"  >
  	<label  for="f19_2">
  		Elementary
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f19_3" name="f19[]"  type="Radio" value="Intermediate"  >
  	<label  for="f19_3">
  		Intermediate
  	</label>
  </div>

  
</div>




<div class="form-group f20 required col-3" data-fid="f20">
  <label class="control-label" for="f20">English level</label>

<div class="Radio">
  	<input  id="f20_1" name="f20[]"  type="Radio" value="Beginner" 
    data-rule-required="true"  >
  	<label  for="f20_1">
  		Beginner
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f20_2" name="f20[]"  type="Radio" value="Elementary"  >
  	<label  for="f20_2">
  		Elementary
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f20_3" name="f20[]"  type="Radio" value="Intermediate"  >
  	<label  for="f20_3">
  		Intermediate
  	</label>
  </div>

  
</div>




<div class="form-group f24 required col-3" data-fid="f24">
  <label class="control-label" for="f24">MS Outlook</label>

<div class="Radio">
  	<input  id="f24_1" name="f24[]"  type="Radio" value="Basic" 
    data-rule-required="true"  >
  	<label  for="f24_1">
  		Basic
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f24_2" name="f24[]"  type="Radio" value="Intermediate"  >
  	<label  for="f24_2">
  		Intermediate
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f24_3" name="f24[]"  type="Radio" value="Advanced"  >
  	<label  for="f24_3">
  		Advanced
  	</label>
  </div>

  
</div>




<div class="form-group f22 required col-3" data-fid="f22">
  <label class="control-label" for="f22">MS Excel</label>

<div class="Radio">
  	<input  id="f22_1" name="f22[]"  type="Radio" value="Basic" 
    data-rule-required="true"  >
  	<label  for="f22_1">
  		Basic
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f22_2" name="f22[]"  type="Radio" value="Intermediate"  >
  	<label  for="f22_2">
  		Intermediate
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f22_3" name="f22[]"  type="radio" value="Advanced"  >
  	<label  for="f22_3">
  		Advanced
  	</label>
  </div>

  
</div>




<div class="form-group f23 required col-3" data-fid="f23">
  <label class="control-label" for="f23">MS Access</label>

<div class="Radio">
  	<input  id="f23_1" name="f23[]"  type="Radio" value="Basic" 
    data-rule-required="true"  >
  	<label  for="f23_1">
  		Basic
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f23_2" name="f23[]"  type="Radio" value="Intermediate"  >
  	<label  for="f23_2">
  		Intermediate
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f23_3" name="f23[]"  type="Radio" value="Advanced"  >
  	<label  for="f23_3">
  		Advanced
  	</label>
  </div>

  
</div>




<div class="form-group f21 required col-3" data-fid="f21">
  <label class="control-label" for="f21">MS Word</label>

<div class="Radio">
  	<input  id="f21_1" name="f21[]"  type="Radio" value="Basic" 
    data-rule-required="true" style="height: 20px"  >
  	<label  for="f21_1">
  		Basic
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f21_2" name="f21[]"  type="Radio" value="Intermediate"  >
  	<label  for="f21_2">
  		Intermediate
  	</label>
  </div>

  <div class="Radio">
  	<input  id="f21_3" name="f21[]"  type="Radio" value="Advanced"  >
  	<label  for="f21_3">
  		Advanced
  	</label>
  </div>

  
</div>




<div class="form-group f32 " data-fid="f32">
  <label class="control-label" for="f32">Untitled</label>


  
</div>




<div class="form-group f25 required" data-fid="f25">
  <label class="control-label" for="f25">Upload clear photo</label>

<input type="file" class="form-control" id="f25" name="f25"  value=""   
    data-rule-required="true"  data-allowedFileExtensions="png,jpg,jpeg,svg,bmp,gif,tif,tiff,raw,nef,cr2,crw,dng,srf,arw"    data-showUpload="false" data-showZoom="false"/>
  
</div>




<div class="form-group f26 " data-fid="f26">
  <label class="control-label" for="f26">Upload C.V.</label>

<input type="file" class="form-control" id="f26" name="f26"  value=""   
     data-allowedFileExtensions="docx,pptx,doc,ppt,rtf,pdf"    data-showUpload="false" data-showZoom="false"/>
  
</div>



<div class="form-group submit f0 " data-fid="f0" style="position: relative;">
  <label class="control-label sr-only" for="f0" style="display: block;">Submit Button</label>

  <div class="progress" style="display: none; z-index: -1; position: absolute;">
    <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%">
    </div>
  </div>

  <button type="submit" class="btn btn-primary btn-lg" style="z-index: 1;">
  		Submit
  </button>

</div>
<div class="clearfix">


  <input type='hidden' name='articleid' id='articleid' value='<? echo $_GET["id"]; ?>' />
  <input type='submit' value='Submit' />  
</form>

the code below is the first page which should be used by the guest Page1.php

<? include("manage_CVs.php"); ?>

<h1>This is page1.php</h1>

<div style='margin:20px; width:100px; height:100px; background:blue;'></div>

<?php include("formcode.php"); ?>

That's all what the codes which I have, as I mentioned I'm newbie and I followed a tutorial to made the above.

 

what is not working : 

1- date filed in the Formcode.php is not appears like a date filed, it looks like text filed.

<div class="input-group date">
<input type="text" class="form-control datepicker" id="f4" name="f4" value=""   
    data-rule-required="true"  
  data-datepicker-format="dd/mm/yyyy"
  data-datepicker-startDate="-18"
  data-datepicker-startView="1"
  data-datepicker-minViewMode="2"
  data-datepicker-multidate="false"
  data-datepicker-multidateSeparator="/" />
<span class="input-group-addon right"><i class="glyphicon glyphicon-th"></i> </span></div>
   

2- the Radio code which I have below, not showing the chosen answer in the database

<div class="form-group f6 required col-3" data-fid="f6">
  <label class="control-label" for="f6"><strong>Visa Type</strong></label>

<div class="Radio">
  	<input  id="f6_1" name="f6[]"  type="Radio" value="Art. 22" 
    data-rule-required="true"  > 
<label  for="f6_1">
  		Art. 22
  	</label>  </div>

  <div class="Radio">
  	<input  id="f6_2" name="f6[]"  type="Radio" value="Art. 18"  >
  	<label  for="f6_2">
  		Art. 18
  	</label>  </div>

  <div class="Radio">
  	<input  id="f6_3" name="f6[]"  type="Radio" value="Art. 17"  >
  	<label  for="f6_3">
  		Art. 17
  	</label>
  </div>

hope that this makes it more clear because I'm confused 

 

Thank you in advance

Oh my.

 

Before you do anything, I suggest you start with a beginner's course for PHP (like the one on CodeAcademy). As long as you struggle with even the most syntax rules, it's pointless to try a complex project. Learn the basics of PHP, learn how to connect to a database system in the 21st century, then come back.

  • Like 1

Sounds like sarcasm, which won't get you much help anywhere.

 

You have apparently 'found' this code somewhere and think that it is a good starting point for your project.  The only thing is that it is outdated and should not be used.  If you were actually learning PHP you would have discovered that by now.

 

You have been given some good advice which, if you are seriously considering 'learning' php, you should follow.  Don't go off and sulk with one final silly comment.

 

PS - you need to recognize the mistakes you are making in your English too:

filed - was probably supposed to be 'filled' the first time you used it

filed - was probably supposed to be 'field' the second time

 

PHP variable names cannot have embedded spaces.

 

PHP is also a case-sensitive language therefore you REALLY don't want to be creating variable names with all kinds of upper- and lower-case letters.  You will be kicking yourself down the road as you forget how you named something earlier.

 

Do you have any JS code in this script?  Because if you don't then all those unique id names on your input tags are worthless since you can't reference them from PHP.

  • Like 1

Thank you for you clarification, and regarding my last post, it is not a sarcasm, I came looking for help not for anything else.

 

Actually before I ask for help in here I've searched in some sites to do what I'm trying to do.

 

I didn't pretend that I'm an expert, I was following this tutorials "http://www.inmotionhosting.com/support/website/sending-email-from-site/using-the-php-mail-function-to-send-emails" and any prof. like you will easily recognize that they have mistakes in their learning codes which will not make it work, BUT for me it took much effort and time until I understand that the problems is in the codes, and I've to search more again in other places.

 

what you see above is the result which I came out with at last, even if it is wrong "and that's why I'm here".

 

I'm not trying to be a developer, I just try to unify a Job application form.

 

No I don't have any JS codes

I will take your instructions into consideration and recheck it all again

 

at last thank you for your time and for your clarification. 

I understand you want to get your task done. The problem, as I already told you, is that you struggle with PHP at a much more fundamental level: syntax, variables, basic form processing, database interaction, security and probably more. This needs to be resolved before we can even begin to discuss your problem, and I don't think anybody here has the time to give you personal lessons.

 

I know it's tempting to just copy and paste random code from the Internet and then go to an online community to fix and adjust it. But there's a limit to this approach. You'll need at least a basic understanding of PHP.

 

If you don't speak Japanese at all, you wouldn't expect people to help you write an epic novel in Japanese, right?

Edited by Jacques1
  • Like 1
  • 4 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.