Jump to content

tanzeelniazi

New Members
  • Posts

    4
  • Joined

  • Last visited

tanzeelniazi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks mac_gyver, I will keep a note of it.
  2. I think the rows affected by your are query are zero, therefore, you are getting this error.
  3. I think the problem is in $con=mysqli_connect("db","dbuser","$password","db","3306"); You are not connecting to any host, your value "db" for host and database can't be same. The correct syntax is: mysqli_connect($host, $db_user, $db_user_password, $database); I haven't seen rest of the code, correct it and then tell if it works or not.
  4. Although there are numerous problems with your page, like no validation on fields, no-compatibility with Firefox etc. But I have rewritten the PHP code for you. I haven't done anything fancy but made all the fields compulsory and also a string will be echoed out to the user indication whether the form was submitted or not. Also added the possibility to email the form details to the site administrator. You should also consider changing database username and password, database as they are exposed to the world, you can get into a lot of trouble. Hope it will help you Regards, <!DOCTYPE html> <html> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['cname']) && !empty($_POST['cont']) && !empty($_POST['email']) && !empty($_POST['mess']) && isset($_POST['submit']) ) { $host = 'localhost'; $user = 'root'; $pass = 'pranit'; $db = 'simtech'; $conn = @mysqli_connect($host, $user, $pass, $db); if(!$conn) {die ("Can't Connect");} $name = $_POST['cname']; $cont = $_POST['cont']; $email = $_POST['email']; $mess = $_POST['mess']; $db_table = 'gen_enq'; $query = "INSERT INTO {$db_table} (cname, cont_no, email_id, message) VALUES ('{$name}', '{$cont}', '{$email}','{$mess}') "; $results = mysqli_query($conn, $query); if (!$results) { die("Can't Process the Form right now."); } else { $admin_email = 'your_email@xyz.com'; $email_subject = 'New Form Submitted'; $email_message = " {$name} has contacted you via your website form. His email address is {$email} and his message is as follows \" {$mess} \" "; /* Remove (//) from the line below and adjust the above variables to use the email functionality to the Websiste Administrator. */ // mail ($admin_email, $email_subject, $email_message); $status = "Your Information is submitted, We'll contact you shortly. Thanks!"; } } else { $status = "Your Inforamtion was not submitted. All fields are required."; } ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Software Development Company - Malegaon, Website Designing Company</title> <link rel="stylesheet" href="main.css" type="text/css"> <link rel="icon" href="media/simtechlogo.png" type="image/png"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <meta name="keywords" content="WOW Slider, Slideshow jQuery Free Download, jQuery Slideshow Background" /> <meta name="description" content="WOWSlider created with WOW Slider, a free wizard program that helps you easily generate beautiful web slideshow" /> <!-- Start WOWSlider.com HEAD section --> <link rel="stylesheet" type="text/css" href="media/engine1/style.css" /> <script type="text/javascript" src="media/engine1/jquery.js"></script> <!-- End WOWSlider.com HEAD section --> <SCRIPT TYPE="text/javascript"> <!-- //Disable right click script //visit http://www.rainbow.arch.scriptmania.com/scripts/ var message="Sorry, right-click has been disabled"; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </SCRIPT> <SCRIPT TYPE="text/javascript"> <!-- //Disable select-text script (IE4+, NS6+) //visit http://www.rainbow.arch.scriptmania.com/scripts/ /////////////////////////////////// function disableselect(e){ return false } function reEnable(){ return true } //if IE4+ document.onselectstart=new Function ("return false") //if NS6 if (window.sidebar){ document.onmousedown=disableselect document.onclick=reEnable } // --> </SCRIPT> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $('body').fadeIn(1000); }); </script> <center> <div class="wrapper"> <center> <p> <img src="media/sim1.png" height="200" width="400"> </p> </center> <div class="container"> <div class="navMenu"> <ul> <li><a href="index.php"><img src="media/home.png"></a></li> <li><a href="about.php">About Us</a></li> <li><a href="#">Services</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Our Products</a></li> <li><a href="#">Downloads</a></li> <li><a href="#">Contact Us</a></li> </ul> </div> <div class="social"> <ul> <li><a href="#"><img src="media/facebook.png"></a></li> <li><a href="#"><img src="media/twitter.png"></a></li> <li><a href="#"><img src="media/linkedin.png"></a></li> </ul> </div> <div class="contss"> <ul> <li style="border-right: 1px solid #555555;"> <img src="media/Graphic2.jpg"><hr> Vrindavan Park, Sayali Appt. 60 Feet Road, <br> Near BSNL Exchange Office, Malegaon - 423203<br> Contact: 02554 - 250135 / +91 - 9096812185. </li> <li style="border-radius: 10px; background-image: url(media/menu.png); background-size: cover; margin-left: 30px;-webkit-box-shadow: 0 8px 6px -6px #00ADC5; -moz-box-shadow: 0 8px 6px -6px #00ADC5; box-shadow: 0 8px 6px -6px #00ADC5; "> <h3>Contact Us</h3> <form action="" method="post"> <table> <tr> <th>Your Name:</th> <td><input type="text" name="cname"></td> </tr> <tr> <th>Your Contact No:</th> <td><input type="text" name="cont"></td> </tr> <tr> <th>Your Email:</th> <td><input type="text" name="email"></td> </tr> <tr> <th>Your Message:</th> <td><textarea name="mess"></textarea></td> </tr> <tr> <th></th> <td><button type="submit" name="submit">&checkmark; Submit</button> </td> </tr> </table> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($status)){ echo $status; } ?> <br> </li> </ul> </div> </div> <br><br><br><br> <div class="footer"> <b>&COPY; Copyright 2013 - 14 : All Rights Reserved</b><br><hr> <table> <tr> <th> <a href="#">Home</a><br><br> <a href="#">About Us</a><br><br> <a href="#">Software Development</a><br><br> <a href="#">Web Designing</a><br> </th> <th> <a href="#">Web Application Development</a><br><br> <a href="#">Web Hosting</a><br><br> <a href="#">Search Engine Optimization</a><br><br> <a href="#">Android Development</a><br> </th> <th> <a href="#">Softwares</a><br><br> <a href="#">Web Sites</a><br><br> <a href="#">Web Applications</a><br><br> <a href="#">Software Products</a><br> </th> <th> <a href="#">Web Application Products</a><br><br> <a href="#">Android Products</a><br><br> <a href="#">Broucher Downloads</a><br><br> <a href="#"></a><br> </th> </tr> </table><br> </div> </center> </body> </html>
×
×
  • 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.