Noob Question about contact us forms

Discussion in 'Programming' started by Legendary11, Mar 19, 2012.

  1. #1
    Hello,

    I am terrible when it comes to coding, but good when it comes to editing existing coding.

    However, I am currently thinking of a website design where you have a 3 step process.

    Page 1:
    Add details about name, address.

    Page 2
    fill in some details about what university you want to go to, top 5 odd choices.

    Page 3
    This page requests the user to upload the files that are needed, for example when applying in the UK for university as an internaiton student you will always need:
    school certificate and transcript (translated), passport photocopy and IELTS or similar english language certificate.

    So this page requests thoses (if you doing masters then you need references, personal statement, cv etc so there will be a good amount of upload boxes)

    The reason for the multi page system is that I want it to be as user friendly as possible, so the front page says 'three easy steps' and then there are 3 short pages each with an explination expanding what is needed/why.

    The question is:

    What do i need to pull this off?
    I dont think I can do this is HTML/CSS

    But is there some coding similar out there in PHP? or other? that can easily be put into a website?

    I know there must be something like it as I see it all the time on offer sites, but I dont want the data saved on the website, but instead emailed to me once all fields are filled (or required fields at least).

    Any ideas?

    I would be really greatful, heck ill even put you in the thank you section of my website once developed :D
     
    Legendary11, Mar 19, 2012 IP
  2. RonBrown

    RonBrown Well-Known Member

    Messages:
    934
    Likes Received:
    55
    Best Answers:
    4
    Trophy Points:
    105
    #2
    That wouldn't be difficult at all for anyone with even a little bit of experience in coding.

    If you're determined to give it a try for yourself, find some well commented "send email" code as that will have about 80% of what you're looking. Look for some info on SELECT CASE (VB - sure to be a PHP equivalent) for showing the info needed depending upon earlier requests and you'll be 90% of the way there. The difficulty will be in maintaining state information between pages, particularly after the upload. If you're looking at ASP.NET then the page wizard control will help you enormously.
     
    RonBrown, Mar 19, 2012 IP
  3. Legendary11

    Legendary11 Well-Known Member

    Messages:
    1,179
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Okay so i found this post thats to your information:
    http://webdesign.about.com/od/forms/a/aa072699multi.htm

    it talks about html multi page forms, tried to use youtube but got nothing of value.

    I do not understand how you have form1 on page 1, then pass that information over to page 2, using hidden tags whilst displaying form 2 and then again on page 3 displaying form 1 and 2 as hidden tags but showing form 3 and then submitting them all.

    Can you point me to some kind of script that would work for this?

    I assume there must be php somewhere in it as I dont think html can support uploading of files, which will be asked on the final page.

    Would be really greatful for any guidance, having my design coded and should have it and be ready to go on coding in about 48 hours :p
     
    Legendary11, Mar 20, 2012 IP
  4. Legendary11

    Legendary11 Well-Known Member

    Messages:
    1,179
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Hello again.

    I have figured out how to parse the information from page 1 to 2 and to page 3.

    I have also found an email script: http://designbyelle.com.au/journal/2008/04/23/php-mailer-form-with-file-attachment/ that has the file attachment code I was looking for.

    However I want to be able to add multiple files instead of just one.

    In my form I am using name="attachment[]" but I do not know how to edit the file so that it will allow me to upload multiple files.

    When I only edit the form I get the error: is_uploaded_file() expects parameter 1 to be string, array given in ..... line.....

    the line is:

    if (is_uploaded_file($fileatt)) {
    // Read the file to be attached ('rb' = read binary)
    $file = fopen($fileatt,'rb');
    $data = fread($file,filesize($fileatt));
    fclose($file);

    // Base64 encode the file data
    $data = chunk_split(base64_encode($data));

    // Add file attachment to the message
    $message .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt_type};\n" .
    " name=\"{$fileatt_name}\"\n" .
    //"Content-Disposition: attachment1;\n" .
    //" filename=\"{$fileatt_name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $data . "\n\n" .
    "--{$mime_boundary}--\n";
    }

    How would i change this? would appreciate any help.
     
    Legendary11, Mar 24, 2012 IP