473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Why is the feedback form is not submmiting

hi

i have created a feedback form , its working on wamp server but in online its not posting data to database. here am providing code please someone help me.

Feedback.php

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2. function validate(nm, eml, fdk, ph)
  3. {
  4.    var name = document.getElementById(nm);
  5.    var email = document.getElementById(eml);
  6.    var feedback = document.getElementById(fdk);
  7.    var phone = document.getElementById(ph);
  8.    if (name.value == "")
  9.    {
  10.       alert("Please Enter Your Name..!");
  11.       name.focus();
  12.       return false;
  13.    }
  14.    if (email.value == "")
  15.    {
  16.       alert("Please Enter Email-id..!");
  17.       email.focus();
  18.       return false;
  19.    }
  20.    var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
  21.    var phone = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/
  22.    // var phoneRe = /^\d{10}(-)/
  23.    if ( ! emailRe.test(email.value))
  24.    {
  25.       alert('Email-id Is Invalid');
  26.       return false;
  27.    }
  28.    if (phone.value = "")
  29.    {
  30.       if ( ! phoneRe.test(phone.value))
  31.       {
  32.          alert('Phone Number Is Invalid');
  33.          return false;
  34.       }
  35.    }
  36.    if (feedback.value == "")
  37.    {
  38.       alert("Please Enter Your Feedback..!");
  39.       feedback.focus();
  40.       return false;
  41.    }
  42. }
  43.  
  44.     </script>
  45.  
  46. <form name="testform" method="post"action="submited.php">
  47.  
  48. Neme:<input type="text" name="name" id="name" maxlength="30" size="30" tabindex="1"/>
  49.  
  50. email<input type="text" name="email" id="email" maxlength="34" size="30" tabindex="3"/>
  51.  
  52. Feedback:<textarea name="feedback" rows="7" cols="24" id="feedback"  tabindex="4"></textarea>
  53.  
  54. Phone No:<input type="text" name="contactno" id="phone" maxlength="11" size="30" tabindex="2"/>
  55.  
  56. <input name="Submit" value="Submit" onclick="return validate('name','email','feedback','phone');"  type="submit" tabindex="5"/>
  57.  
  58.  
  59. </form>
  60.  
  61.  
Submited.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         // opening connection
  3.                     $conn=mysql_connect("localhost","root","");
  4.         //  getting database to use
  5.                         mysql_select_db("school",$conn);
  6.         // Sql statements
  7.                 $Name=$_POST["name"];
  8.                 $Contactno=$_POST["contactno"];
  9.                 $Emailid=$_POST["email"];
  10.                 $Feedback=$_POST["feedback"];
  11.     $sql="INSERT INTO feedback values('','$Name','$Contactno','$Emailid','$Feedback')";
  12.         // execute statements
  13.                 $result=mysql_query($sql,$conn);    
  14.                 if($result==1)
  15.                     echo"<font color=black face=Verdana, Arial, Helvetica, sans-serif style=font-size:12px>";
  16.                     echo"Thanks for your feedback,we will get back to you Soon.";
  17.                     echo"</font>";
  18.                     echo"<br><br>";
  19.                     ?>
  20.  
mysql table:
Expand|Select|Wrap|Line Numbers
  1. feedback` (
  2.   `Id` int(11) NOT NULL AUTO_INCREMENT,
  3.   `Name` varchar(30) NOT NULL,
  4.   `Contactno` varchar(60) NOT NULL,
  5.   `Emailid` varchar(40) NOT NULL,
  6.   `Feedback` varchar(500) NOT NULL,
  7.   PRIMARY KEY (`Id`)
  8. )
Oct 28 '10 #1
1 1512
Markus
6,050 Expert 4TB
Turn error reporting on:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Very top of your script
  3. ini_set('display_errors', 1);
  4. error_reporting(-1);
  5.  
Check that your connect to the database and selecting of database worked:

Expand|Select|Wrap|Line Numbers
  1. $conn = mysql_connect('localhost', 'root', '');
  2. if (!$conn)
  3. {
  4.   printf("Error when trying to connect to MySQL server: %s", mysql_error());
  5. }
  6. else
  7. {
  8.   // Do rest
  9. }
  10.  
Also, the mysql_* functions are outdated and have been superseded. Use MySQLi or PDO instead.
Oct 28 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Andrew | last post by:
Where can i find a free feedback form in php script to download it and put it in my website? thanks in advance andreas
2
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from this website. I have it working just fine. I'm...
1
by: Andrew | last post by:
Where can i find a free feedback form in javascript to download it and put it in my website? thanks in advance andreas
7
by: Armand Karlsen | last post by:
On one page of a site I'm doing for a college project, I have a feedback form: http://www.zen62775.zen.co.uk/Test/contact/contact_feedback.html All parts of this page validate, except for the...
6
by: Zagor | last post by:
I have a feedback form in my website with three TextBoxes and a SEND button in a user control. Below is a piece of the code: //On click event for the send LinkButton private void...
1
by: Mario Krsnic | last post by:
Hello! I made a feedback form using ASP.NET and VB.NET. It works, but I receive allways two mails from server instead of one. Why? Thanks for every idea! Mario Here the code: Imports...
0
by: vijay | last post by:
hello friends, I have done one website by using frontpage 2005 and i have done the feedback form.Now I want to send this feedback form to email id.I have used mailto: in form tag...
1
by: lali | last post by:
hi everybody, i am doing a project and i have strucked in middle of my code usiong asp. the problem is, in the feedback form there are many fields which are manidatory.when an user fills the form...
15
by: nickyspace | last post by:
i have a code wherein it is asking email id and message from the user in the form named as feedback.html HTML CODE AS BELOW<html> <body> <form method="post" action="sendmail.php"> Email:...
0
by: gnawz | last post by:
I have a feedback form code which does email but does not display the correct content. In place of the email address, it displays "+1" And the body message is "1" It works well when I test...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.