Jump to content

princesohrab

Members
  • Posts

    55
  • Joined

  • Last visited

Profile Information

  • Location
    London
  • Interests
    Web Design, Graphic Design, Photography

princesohrab's Achievements

Newbie

Newbie (1/7)

3

Reputation

  1. it works now.. Ive figured it out..It was to do with setting the keys..Im very new to this.. sorry to be a pain guys
  2. Ok thanks.. Where do I put this mysqli_error() to get the error message?
  3. Hi Birbal,In my table called "people" I created through MySql,I have 3 columns:peopleid (auto increment)firstnamelastname which one should be primary key? At the moment,peopleid and firstname fields are as primary key. Im trying to set only the peopleid as primary but for some reason it wont let me.
  4. Oh, I get the error message which I echoed in the statement.. Error inserting new record but only if there's one entry saved on the database already..
  5. I have created the table with 3 columns..peopleidfirstnamelastnameI believe I have them all as primary key.. (I'm not home, on the way to work)Which one should be primary key?Only peopleid?? peopleid is auto increment and was defined as medium integer..The code seems fine.. I think it's to do with the structure if the table..I'm not sure..I will reset a table and please let me know which one to use as primary.Thanks
  6. Hi all,Im am trying to use a web form to send data to a table called "people" in my database using php.The script store the first time you submit the for and the data goes to the correct table too. The problem is it only allows you to do it only once meaning only 1 entry is registrered. If I try again, I get error message. Then i delete the entry from the database, I refresh the form, send again and it registers. I just need to know how to make it register more than one person's details. Below is the code <?phpif (isset($_POST['submitted'])) {include('w-hill-reg-form-database-connect.php');$fname = $_POST['fname'];$lname = $_POST['lname'];$sqlinsert = "INSERT INTO people (firstname, lastname) VALUES ('$fname', '$lname')";if (!mysqli_query($dbcon, $sqlinsert)) { die ('Error inserting new record');}$newrecord = "New record added";}?><html><head><title>CALLING ALL TENNIS PLAYERS!</title></head><body><form method="post" action="w-hill-registration-form-php.php"><input type="hidden" name="submitted" value="true" /><fieldset><legend>New People</legend> <label>First Name: <input type="text" name="fname" /></label> <label>Last Name: <input type="text" name="lname" /></label></fieldset><br/><input type="submit" value="Add new person" /></form><?phpecho $newrecord // New record added statement added at the top?></body></html>
  7. I just had to put the define host first
  8. Hey sorry guys.. Ive done itthanks
  9. hi all, wondering if you would be able to help me..im trying to connect to my database but i keep getting the error message which i echo in the page <?php DEFINE('DB_USER', 'ok');DEFINE('DB_PASSWORD', 'ok');DEFINE('DB_HOST', 'ok.com.mysql');DEFINE('DB_NAME', 'o_co');$dbconnect = mysql_connect(DB_USER, DB_PASSWORD, DB_HOST, DB_NAME);if (!$dbconnect) {die('Error connecting to the database');} echo 'You have connected successfully';?>
  10. The one thing Im lost on is creating the CSV file..Does that file stay opn the server? Do I create it with Excel? Then how to link the 2 together?
  11. Thanks.. Appreciate it..I will do it step by step and if I get stuck, Ill get back to you.I found a few tutorials and hopefully Ill get my head around it.Thanks
  12. That is exacly what needs to be done.. But I am more of a front end guy..Im not too sure how to proceed about it.Your help is greatly appreciated. I found this tutorial Not sure if its the same thing..I really need to figure this out.
  13. Hi all,Online registration form which allow users to fill in their details and send the data by submitting the form to my email using php.I need to create an online registration form and when the form is submitted, the data needs to go in to a spreadsheet in (MS EXCEL). Maybe a database I guess..The data should be able to be accessed at any time and read by a spreadsheet by someone in the office. Someone sent me this code $df = fopen("php://output", 'w'); fputcsv($df, array_keys(reset($array))); foreach ($_POSTas $row) { fputcsv($df, $row); } fclose($df); Can anyone help me as to where and how I use this snippet to get it to work. Basically the form data needs to be written into a CSV file. Here is the form: <form action="http://www.sohrabgoodar.com/w-hill-contactformprocess.php" method="post" id="comments_form"><div class="row"> <div class="label">Name</div><!--end .label--> <div class="input"> <input type="text" for="name" id="name" class="detail" name="name" /> </div><!--end .input--> </div><!--end .row--> <div class="row"> <div class="label">Work Location</div><!--end .label--> <div class="input"> <input type="text" for="worklocation" id="worklocation" class="detail" name="worklocation" /> </div><!--end .input--> </div><!--end .row--> <div class="row"> <div class="label">Work Contact Number</div><!--end .label--> <div class="input"> <input type="text" for="worknumber" id="worknumber" class="detail" name="worknumber" /> </div><!--end .input--> </div><!--end .row--> <div class="row"> <div class="label">Mobile Contact Number</div><!--end .label--> <div class="input"> <input type="text" for="mobile" id="mobile" class="detail" name="mobile" /> </div><!--end .input--> </div><!--end .row--> <div class="row"> <div class="label">Email Address</div> <!--end .label--> <div class="input"> <input type="text" for="email" id="email" class="detail" name="email" /> </div><!--end .input--> </div><!--end .row--> <div class="row"> <div class="label">Ability Level</div> <!--end .label--> <div class="input3"> <select name="ability" for="ability" id="ability" class="detail"> <option>Please Choose</option> <option value="strong">Strong</option> <option value="medium">Medium</option> <option value="weak">Weak</option> </select> </div><!--end .input3--> </div><!--end .row--> <div class="row"> <div class="label">Tennis Standard</div> <!--end .label--> <div class="input3"> <select name="standard" for="standard" id="standard" class="detail"> <option>Please Choose</option> <option value="school">School</option> <option value="club">Club</option> <option value="county">County</option> <option value="international">International</option> </select> </div><!--end .input3--> </div><!--end .row--> <div class="row"> <div class="label">Frequency of Play</div> <!--end .label--> <div class="input3"> <select name="frequency" for="frequency" id="frequency" class="detail"> <option>Please Choose</option> <option value="weekly">Weekly</option> <option value="monthly">Monthly</option> <option value="fewtimes">Few Times a Year</option> </select> </div><!--end .input3--> </div><!--end .row--> <div class="row"> <div class="label2">Anything else you would like to tell us?</div><!--end .label2--> <div class="input2"> <textarea id="comment" name="comment" class="mess"></textarea> </div><!--end .input--> </div><!--end .row--> <div class="submit"> <input type="submit" id="submit" name="submit" value="Send Message" /> </div><!--end .submit--></form> Here is the old php file I was using to send the form data to emails. <?php $emailSubject = 'Tennis Registration!';$webMaster = 'someone@yahoo.co.uk';$nameField = $_POST['name'];$worklocationField = $_POST['worklocation'];$worknumberField = $_POST['worknumber'];$mobileField = $_POST['mobile'];$emailField = $_POST['email'];$abilityField = $_POST['ability'];$standardField = $_POST['standard'];$frequencyField = $_POST['frequency'];$commentField = $_POST['comment'];$body = <<<EOD<br><hr><br>Name: $nameField <br>Work location: $worklocationField <br>Work Number: $worknumberField <br>Mobile: $mobileField <br>Email: $emailField <br>Ability: $abilityField <br>Standard: $standardField <br>Frequency: $frequencyField <br>Comment: $commentField <br>EOD;$headers = "From: $email\r\n";$headers .= "Content-type: text/html\r\n";$success = mail($webMaster, $emailSubject, $body, $headers);$theResults = <<<EOD<p>Thank you for your Message! You will be redirected to the home page in a moment</p><script type="text/javascript" >setTimeout ('ourRedirect()', 3000)function ourRedirect(){ location.href='http://www.google.com/'}</script>EOD;echo "$theResults";?>
  14. ok.. I want it to write to an XLS file. How do i set up that file on the server andWhat are the functions on the PHP file?Have you got an example please? Im in real trouble as I need to get that done by tomorrow morning. this task is part of a recruitment process. Basically they told me: (Set up an “apply online” functionality – so that the person who review the data can get all the information he needs to get a team together. This should be provided on an excel spreadsheet) They also said: (It is not useful for members of the management team to receive emails every time someone applies in these circumstances so we usually have functionality which transfers the information into an excel spreadsheet so once the closing date) has passed we return the necessary data on this.
×
×
  • Create New...