Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP Form, not working simply reloads html.

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #161149
    horrigan97
    Participant

    I’m a little new to php. I have my website hosted and everything but when i submit the form it doesn’t work. here’s the html:

    `

         <form id="info_email" action="contact.php" method="post">
        <ul class="submitlist">
          <li class="catch">
            Get A Free Offer
          </li>
          <br>
          <li>
            <input name="First Name" placeholder="First Name" type="text" title="Your First Name" required>
          </li>
    
          <li>
            <input name="Last Name" placeholder="Last Name" type="text" title="Your Last Name" required>
          </li>
          <li>
            <input name="Email" placeholder="Contact Email" title="Your Email" type="email" required>
          </li>
          <li>
            <input name="Contact Phone #" title="Contact Phone" type="text" placeholder="Contact Phone #" required>
          </li>
          <li>
            <input type="text" title="Property Zip Code" name="Property Zip Code" placeholder="Property Zip Code" required>
          </li>
          <li>
            <input type="text" title="Property Address" name="Property Address" placeholder="Property Address" required>
          </li>
          <li>
            <input type="submit" value="Submit Information">
          </li>
          <li class="special" >
            *We will never share your private information.
          </li>
        </ul>
      </form>
    

    `

    and the php:

    `<?php
    $to = “[email protected]” ;
    $from = $_REQUEST[‘Email’] ;
    $name = $_REQUEST[‘First Name”Last Name’] ;
    $headers = “From: $from”;
    $subject = “Web Contact Form”;

    $fields = array();
    $fields{“First Name”} = “First Name”;
    $fields{“Last Name”} = “Last Name”;
    $fields{“Email”} = “Email”;
    $fields{“Contact Phone #”} = “Contact Phone #”;
    $fields{“Property Zip Code”} = “Property Zip Code”;
    $fields{“Property Address”} = “Property Address”;
    ?> `

    #161150
    __
    Participant

    when i submit the form it doesn’t work.

    What do you mean?

    Describe what you want to happen, compared to what actually happens. Be specific and detailed.

    and [here is] the php:

    Your php code has many errors in it which would cause parse errors (i.e., the code would not run at all), so I am assuming that they are typos in your post. Can you post the actual code (i.e., copy+paste; perhaps make a gist on github) that you’re using?

    Assuming the errors don’t exist in the actual script, all this code does is take the values of the form submission. You don’t try to actually do anything with the information, so, I wouldn’t expect anything to happen.

    Is your php code in the same file as the html form?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.