Jump to content

registrarion form help...


galleeandfarel

Recommended Posts

in my registration form,i have two php files,one is register.php that is used to connect the  database,and post my registration values into database,and another one is upload.php it used to upload the files int to one folder,how can i place these two php files,and get the output from the same form.....

 

my register.php is:

<?php

session_start();

$link = mysql_connect('localhost', 'root', '');

if (!$link) {

    die('Could not connect: ' . mysql_error());

}

$dbselect = mysql_select_db('anand')or die("Can not select ");

if(!$dbselect){

    die('Could not connect: ' . mysql_error());

}

if($_REQUEST["Check"] == 1)

{

$companyname = $_POST["companyname"];

$email = $_POST["email"];

$password = $_POST["password"];

$confirmpassword = $_POST["confirmpassword"];

$landlineareacode = $_POST["landlinearecode"];

$landline = $_POST["landline"];

$mobile = $_POST["mobile"];

$contact1 = $_POST["contact1"];

$contact2 = $_POST["contact2"];

$contact3 = $_POST["contact3"];

$contactpin = $_POST["contactpin"];

$corporate1 = $_POST["corporate1"];

$corporate2 = $_POST["corporate2"];

$corporate3 = $_POST["corporate3"];

$corporatepin = $_POST["corporatepin"];

$turnover = $_POST["turnover"];

$help1 = $_POST["help1"];

$help2 = $_POST["help2"];

$help3 = $_POST["help3"];

$profile = $_POST["profile"];

$upload_profile = $_POST["upload_profile"];

$query = "insert into employerstep1(companyname,email,password,confirmpassword,landlineareacode,landline,mobile,contact1,contact2,contact3,contactpin,corporate1,corporate2,corporate3,corporatepin,turnover,help1,help2,help3,profile,upload_profile) values('$companyname','$email','$password','$confirmpassword','$landlineareacode','$landline','$mobile','$contact1','$contact2','$contact3','$contactpin','$corporate1','$corporate2','$corporate3','$corporatepin','$turnover','$help1','$help2','$help3','$profile','$upload_profile')";

}

$result = mysql_query($query);

mysql_close($link);

 

?>

 

 

my upload.php is:

 

<?php

  // Configuration - Your Options

      $allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation.

      $max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB).

      $upload_path = './files/'; // The place the files will be uploaded to (currently a 'files' directory).

 

  $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).

  $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.

 

  // Check if the filetype is allowed, if not DIE and inform the user.

  if(!in_array($ext,$allowed_filetypes))

      die('The file you attempted to upload is not allowed.');

 

  // Now check the filesize, if it is too large then DIE and inform the user.

  if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)

      die('The file you attempted to upload is too large.');

 

  // Check if we can upload to the specified path, if not DIE and inform the user.

  if(!is_writable($upload_path))

      die('You cannot upload to the specified directory, please CHMOD it to 777.');

 

  // Upload the file to your specified path.

  if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))

        echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; // It worked.

      else

        echo 'There was an error during the file upload.  Please try again.'; // It failed :(.

 

?>

plz help me to solve this....

 

Link to comment
https://forums.phpfreaks.com/topic/114244-registrarion-form-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.