vendredi 8 mai 2015

Simple contact form not working

so im trying to make a simple contact form, follow the guide i have to two files, contact.php and the index.php

i want that couple of options will appear in my index.php file in the "Enquiry type" those options i put in array in th contact.php file like this:

<?php

class Contact{

        public static $types = array(

    1 => 'Product enquiry',
    2 => 'Billing enquiry',
    3 => 'Support enquiry'


                );
}

i also connect this file with this code in the first line in the index.php:

<?php require_once('file:///D:/Simple%20Contact%20Form/Liberay/Contact.php'); ?>

, but after i tried lots of times i cant see in the drop down field any of that options, so probably its something with connection maybe? and when im tring out php things do i have to put it in local server as Xampp that it will work ?

this is the full code from index.php:

<?php require_once('file:///D:/Simple%20Contact%20Form/Liberay/Contact.php'); ?>

<!DOCOTYPE html>
<html>
<head>
 <meta charset="utf-8" />
 <meta name="viewport" content="width=device-width" />
 <title>Simple contact form with PHP</title>
 <link rel="stylesheet" type="text/css" href="file:///D:/Simple%20Contact%20Form/CSS/core.css"/>

</head>

<body>
<form method="post" id="formContact" class="large-8 large-centered columns custom">       
<fieldset>

<legend>Simple Contact Form with PHP</legend>

<div class="large-6 columns">

        <label for="first_name">First name: *</label>
        <input 
        type="text"
        name="first_name"
     id="first_name"
     placeholder="Your first name"/>
 </div>

 <div class="large-6 columns">

        <label for="last_name">Last name: *</label>
        <input type="text"
        name="last_name"
     id="last_name"
     placeholder="Your last name"/>
 </div>

 <div class="large-6 columns">

        <label for="first_name">Email address: *</label>
        <input type="email"
        name="email"
     id="email"
     placeholder="Your Email address"/>
 </div>

<div class="large-6 columns">

        <label for="type">Enquiry type: *</label>
        <select
         name="type"
          id="type">
    
    <option value="">Select one</option>

   <?php if (!empty(Contact::$types)) { ?>

   <?php foreach(Contact::$types as $id => $type) { ?>

   <option value="<?php echo $id; ?>"><?php  echo $type; ?></option>
   <?php } ?>

    </select>

</div>
<div class="large-12 columns">
        <label for="enquiry">Enquiry: *</label>
        <textarea name="enquiry" id="enquiry" placeholder=" Your message"></textarea>
</div>

<div class="large-12 columns">

<button class="button small">Send message</button>

        </div>


</fieldset>

</form>

<script src="file:///D:/Simple%20Contact%20Form/jquery.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="file:///D:/Simple Contact Form/js/core.js"></script>

</body>




</html>

*soory if theres little bit a mess im trying my best (-:

Aucun commentaire:

Enregistrer un commentaire