Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Php-mysql error undefined index for every variable

Codes here !

Moderators: macek, egami, gesf

Php-mysql error undefined index for every variable

Postby prashantminku » Fri Dec 07, 2012 1:48 am

i am getting this as error.i have checked the spellings correctly.But can't find the solution...please help me solve this.


Notice: Undefined index: name in C:\xampp\htdocs\new\email.php on line 3

Notice: Undefined index: email in C:\xampp\htdocs\new\email.php on line 4

Notice: Undefined index: mobile in C:\xampp\htdocs\new\email.php on line 5

Notice: Undefined index: query in C:\xampp\htdocs\new\email.php on line 6





Here is the html form on the page **Contacts.php**.I want this to be inserted into the database.



<form id="ContactForm" action="email.php" method="post" name="ContactForm" enctype="text/plain" >
<div class="commentForm">

<input type="text" id="nameField" class="nameField" name="name" />
<input type="text" id="emailField" class="emailField" name="email" />
<input type="text" id="mobileField" class="mobileField" name="mobile" />
<textarea id="queryField" class="queryField" name="query" cols="10" rows="5" ></textarea>
<input type="submit" id="sendButton" value="Send" class="sendButton" onClick="return validate();" />
</div>
</form>




And this is the **email.php** page.the name of the database is admissionworld and the name of table is contact.




<?php

$name = $_POST['name'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$query = $_POST['query'];
$db_host = "localhost";
$db_username = "root";
$db_pass = "";
$db_name = "admissionworld";

mysql_connect("$db_host","$db_username",… or die("Could not connect to database");
mysql_select_db("$db_name") or die("No Database");

mysql_query("Insert into contact(name1,email1,mobile1,query1) VALUES ('$name','$email','$mobile','$query')") or die (mysql_error());

?>




i have used this also **var_dump($_POST);**
But it says array(0) { }.
Can you please tell me what is the problem??
prashantminku
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Dec 07, 2012 1:42 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron