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 - <script language="javascript" type="text/javascript">
-
function validate(nm, eml, fdk, ph)
-
{
-
var name = document.getElementById(nm);
-
var email = document.getElementById(eml);
-
var feedback = document.getElementById(fdk);
-
var phone = document.getElementById(ph);
-
if (name.value == "")
-
{
-
alert("Please Enter Your Name..!");
-
name.focus();
-
return false;
-
}
-
if (email.value == "")
-
{
-
alert("Please Enter Email-id..!");
-
email.focus();
-
return false;
-
}
-
var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
-
var phone = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/
-
// var phoneRe = /^\d{10}(-)/
-
if ( ! emailRe.test(email.value))
-
{
-
alert('Email-id Is Invalid');
-
return false;
-
}
-
if (phone.value = "")
-
{
-
if ( ! phoneRe.test(phone.value))
-
{
-
alert('Phone Number Is Invalid');
-
return false;
-
}
-
}
-
if (feedback.value == "")
-
{
-
alert("Please Enter Your Feedback..!");
-
feedback.focus();
-
return false;
-
}
-
}
-
-
</script>
-
-
<form name="testform" method="post"action="submited.php">
-
-
Neme:<input type="text" name="name" id="name" maxlength="30" size="30" tabindex="1"/>
-
-
email<input type="text" name="email" id="email" maxlength="34" size="30" tabindex="3"/>
-
-
Feedback:<textarea name="feedback" rows="7" cols="24" id="feedback" tabindex="4"></textarea>
-
-
Phone No:<input type="text" name="contactno" id="phone" maxlength="11" size="30" tabindex="2"/>
-
-
<input name="Submit" value="Submit" onclick="return validate('name','email','feedback','phone');" type="submit" tabindex="5"/>
-
-
-
</form>
-
-
Submited.php - <?php
-
// opening connection
-
$conn=mysql_connect("localhost","root","");
-
// getting database to use
-
mysql_select_db("school",$conn);
-
// Sql statements
-
$Name=$_POST["name"];
-
$Contactno=$_POST["contactno"];
-
$Emailid=$_POST["email"];
-
$Feedback=$_POST["feedback"];
-
$sql="INSERT INTO feedback values('','$Name','$Contactno','$Emailid','$Feedback')";
-
// execute statements
-
$result=mysql_query($sql,$conn);
-
if($result==1)
-
echo"<font color=black face=Verdana, Arial, Helvetica, sans-serif style=font-size:12px>";
-
echo"Thanks for your feedback,we will get back to you Soon.";
-
echo"</font>";
-
echo"<br><br>";
-
?>
-
mysql table: - feedback` (
-
`Id` int(11) NOT NULL AUTO_INCREMENT,
-
`Name` varchar(30) NOT NULL,
-
`Contactno` varchar(60) NOT NULL,
-
`Emailid` varchar(40) NOT NULL,
-
`Feedback` varchar(500) NOT NULL,
-
PRIMARY KEY (`Id`)
-
)
1 1512
Turn error reporting on: -
<?php
-
// Very top of your script
-
ini_set('display_errors', 1);
-
error_reporting(-1);
-
Check that your connect to the database and selecting of database worked: -
$conn = mysql_connect('localhost', 'root', '');
-
if (!$conn)
-
{
-
printf("Error when trying to connect to MySQL server: %s", mysql_error());
-
}
-
else
-
{
-
// Do rest
-
}
-
Also, the mysql_* functions are outdated and have been superseded. Use MySQLi or PDO instead.
Sign in to post your reply or Sign up for a free account.
Similar topics
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
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |