CaptFares Posted June 27, 2015 Share Posted June 27, 2015 Hello Y'all ! I am preparing this form, the data is not inserting for some reason... I would really appreciate your help guys ! Form : <form action="input.php" method="POST" class="sky-form"> <header>General Assembly Membership Request </header> <fieldset> <section> <label class="label">TCA Callsign:</label> <label class="input" > <input type="text" value="TCA" name="callsign"> </label> </section> <section> <label class="label">First Name:</label> <label class="input" > <input type="text" name="firstname"> </label> </section> <section> <label class="label">Family Name:</label> <label class="input" > <input type="text" name="familyname"> </label> </section> <section> <label class="label">Date of Birth:</label> <label class="input" > <input type="date" name="birthdate"> </label> </section> <section> <label class="label">Email:</label> <label class="input" > <input type="text" name="email"> </label> </section> <section> <label class="label">Job:</label> <label class="input" > <input type="text" name="job"> </label> </section> <section> <label class="label">Full Street Address</label> <label class="textarea textarea-expandable"> <textarea rows="3" name="address"></textarea> </label> <div class="note"><strong>Note:</strong>Used for regular mailing</div> </section> <section> <label class="label">Country of Residence</label> <label class="select"> <select name="country"> <option value="Tunisia">Tunisia</option> <option value="Afghanistan">Afghanistan</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> </select></br> <section> <label class="label">Phone:</label> <label class="input" > <input type="text" name="phone"> </label> </section> <i></i> </label> </section> <!--<section> <label class="label">Scanned ID</label> <label for="file" class="input input-file"> <div class="button"><input type="file" id="file" onchange="this.parentNode.nextSibling.value = this.value">Browse</div><input type="text" readonly> <div class="note"><strong>Note:</strong> Scanned National ID or Passport, required by Tunisian law.</div> </label> </section>--> <section> <label class="label">Link to Scanned ID</label> <label class="input" > <input type="text" name="imgurl"> <div class="note"><strong>Note:</strong> Scanned National ID or Passport, required by Tunisian law.</div> </label> </label> </section> </fieldset> <fieldset> <section class="col col-5"> <label class="label">Languages :</label> <label class="toggle"><input type="checkbox" name="arabic" checked><i></i>Arabic - العربية</label> <label class="toggle"><input type="checkbox" name="french"><i></i>French - Français</label> <label class="toggle"><input type="checkbox" name="english"><i></i>English</label> <label class="toggle"><input type="checkbox" name="spanish"><i></i>Spanish - Español</label> </section> </fieldset> <fieldset> <section> <label class="label"></label> <div class="row"> <label class="checkbox"><input type="checkbox" name="checkbox" checked><i></i>I am 13 years of age or older.</label> <label class="checkbox"><input type="checkbox" name="checkbox"><i></i>I have read and accept the Rules, Statues and By-Laws of the Organisation</label> <label class="checkbox"><input type="checkbox" name="checkbox"><i></i>I commit to pay the contribution fee once accepted.</label> </div> </fieldset> <footer> <button type="submit" class="button">Submit</button> <button type="button" class="button button-secondary" onclick="window.history.back();">Back</button> </footer> </form> Input.php : <?php $callsign=$_POST['callsign']; $firstname=$_POST['firstname']; $familyname=$_POST['familyname']; $birthdate=$_POST['birthdate']; $email=$_POST['email']; $job=$_POST['job']; $country=$_POST['country']; $phone=$_POST['phone']; $imgurl=$_POST['imgurl']; $joindate=time(); $ar=$_POST['arabic']; $fr=$_POST['french']; $en=$_POST['english']; $sp=$_POST['spanish']; $address=$_POST['address']; //parameters $server="tcavaorg.ipagemysql.com"; $user="root"; $password="12345"; $database="tcanpo"; mysql_connect("$server","$user","$password") or die("Couldn't select database."); //database connection mysql_select_db("$database"); $result=mysql_select_db($database, mysql_connect("$server","$user","$password")); //test connection print $result; //inserting data order $order="INSERT INTO members (callsign,firstname,familyname,birthdate,email,job,country,phone,imgurl,joindate,address) VALUES ('$callsign','$firstname','$familyname','$birthdate','$email','$job','$country','$phone','$imgurl','$joindate','$address')"; //declare in the order variable $result1=mysql_query($order); //order executes if($result1){ echo("<br>Input data is succeed"); } else{ echo("<br>Input data is fail"); } ?> I get 1, so the connection to the db is successful. However the data input always fail. Please help ! Thank you Quote Link to comment Share on other sites More sharing options...
Barand Posted June 27, 2015 Share Posted June 27, 2015 See what mysql_error() outputs when it fails Quote Link to comment Share on other sites More sharing options...
CaptFares Posted June 28, 2015 Author Share Posted June 28, 2015 I forgot that ! I identified the problem and now it works, many thanks Barand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.