Jump to content

jazza96

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jazza96

  • Rank
    Member
  1. If I use MYSQLi, do I just add the 'I' after the MYSQL?
  2. Hi Firstly I am new to programming so go easy on me I am building a page where the user inputs text into a table called 'products'. This is the code I am using: $productname=$_POST['productname']; $productprice=$_POST['productprice']; $productpostage=$_POST['productposage']; $productquick=$_POST['productquick']; $productdescription=$_POST['productdescription']; $productdelivery=$_POST['productdelivery']; mysql_connect('localhost', 'username', 'password') or die(mysql_error()); mysql_select_db('Kanga') or die(mysql_error()); mysql_query("INSERT INTO 'product' VALUES ('$productname', '$productprice', '$productpostage', '$productquick', '$productdescription', '$productdelivery')"); print "$productname has been added to the database."; ?> When I press the submit button on the form, I get "Hello world(this is what i entered into the productname field) has been added to the database." I am using phpmyadmin, so should all the data that is submitted show up in there? Thanks Jarrod
  3. Yes, I put an email address in the $from variable and it still didn't work.
  4. No, I have not. It is just on my localhost server (MAMP). <?php error_reporting(-1); ini_set('display_errors', 'On'); $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'email'; $to = 'email'; /* I have my different email in these fields. */ $subject = "Landing page"; $body = "From: $name\n email: $email\n message:\n $message"; ?> <?php if(mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent</p>'; }else{ echo '<p>Something went wrong, go back!</p>'; } ?> <div class="modal fade" id="contact" role="dialog"> <div class=" modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h2>Contact us</h2> <p>Do you have a question, suggestion or comment?</p> </div> <div class="modal-body"> <form method="post" action="index.php"> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" name="name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" name="email" placeholder="Email"> <label for="Message">Message</label> <textarea class="form-control" name="message" placeholder="Message"></textarea> <input type="submit" name="submit" value="Send" action="index.php"></input> </form> </div> </div> <div class="modal-footer"> <a class="btn btn-default" data-dismiss = "modal">Close</a> </div> </div> </div>
  5. It worked!! Thanks One other problem is that the message is not sending now to my nominated email address.
  6. Do you get the error messages after the form submits? Note: to avoid seeing the errors before the form is submitted, move the initial variable declarations inside the construct that tests whether the form was submitted: <?php if ($_POST['submit']){ $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: Jarrod'; $to = 'email'; $subject = "Landing page"; $body = "From: $name\n Email: $email\n Message:\n $message"; if(mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; }else{ echo '<p>Something went wrong, go back!</p>'; } } ?> The errors are appearing when I refresh the page. I put in that code and I am no longer getting this error: Notice: Undefined index: submit in /Applications/MAMP/htdocs/Jumbotron/index.php on line 135 but I am still getting the other error's Notice: Undefined index: name in /Applications/MAMP/htdocs/Jumbotron/index.php on line 124 Notice: Undefined index: email in /Applications/MAMP/htdocs/Jumbotron/index.php on line 125 Notice: Undefined index: message in /Applications/MAMP/htdocs/Jumbotron/index.php on line 126
  7. I am getting 4 undefined errors. Notice: Undefined index: name in /Applications/MAMP/htdocs/Jumbotron/index.php on line 124 Notice: Undefined index: email in /Applications/MAMP/htdocs/Jumbotron/index.php on line 125 Notice: Undefined index: message in /Applications/MAMP/htdocs/Jumbotron/index.php on line 126 Notice: Undefined index: submit in /Applications/MAMP/htdocs/Jumbotron/index.php on line 135
  8. Tried it and it didn't work unfortunately
  9. I have added an action to the form. <div class="modal-body"> <form method="post" action="index.php"> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" id="Name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" id="Email" placeholder="Email"> <label for="Message">Message</label> <textarea class="form-control" id="Message" placeholder="Message"></textarea> <button type="button" class="btn btn-primary">Send</button> </form> </div> </div> The php code is on the index.php file.
  10. Yes, I did that on purpose because I didn't want my email address public.
  11. Hi I am trying to build a contact form and my form isnt sending. Here is my code. (its in a modal window)(I have my email address in the $to variable in the code) <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: Jarrod'; $to = 'email'; $subject = "Landing page"; $body = "From: $name\n Email: $email\n Message:\n $message"; ?> <?php if ($_POST['submit']){ if(mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; }else{ echo '<p>Something went wrong, go back!</p>'; } } ?> <div class="modal fade" id="contact" role="dialog"> <div class=" modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h2>Contact us</h2> </div> <div class="modal-body"> <form method="post" action="index1.php"> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" id="name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" id="email" placeholder="Email"> <label for="Message">Message</label> <textarea class="form-control" id="message" placeholder="Message"></textarea> <input type="submit" value="Send">Send</button> </form> <div class="modal-footer"> <a class="btn btn-default" data-dismiss = "modal">Close</a> </div> </div> </div> </div>
  12. Hi I am currently using bootstrap to design a landing page. I want to add a contact us form and I need to use a text area for long messages. When I use it with bootstrap it just appears as a single line and not a large field. How can I style just 1 field instead of all of them? This is my HTML code. <form> <div class="form-horizontal"> <label for="Name">Your Name</label> <input type="text" class="form-control" id="Name" placeholder="Name"> <label for="Email">Your Email</label> <input type="Email" class="form-control" id="Email" placeholder="Email"> <label for="Message">Message</label> <input type="textarea" class="form-control" id="Message" placeholder="Message"> </form>
  13. Thanks for those tips. I have started a new project where I am building a social networking site like facebook.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.