Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Undefine index php (HELP)

General discussions related to php

Moderators: macek, egami, gesf

Undefine index php (HELP)

Postby prosate » Tue Mar 12, 2013 5:52 pm

( ! ) Notice: Undefined index: emailaddress_input in C:\wamp\www\test\feedbackadd.php on line 17
Call Stack
# Time Memory Function Location
1 0.0012 256400 {main}( ) ..\feedbackadd.php:0

( ! ) Notice: Undefined index: telephonenumber_input in C:\wamp\www\test\feedbackadd.php on line 18
Call Stack
# Time Memory Function Location
1 0.0012 256400 {main}( ) ..\feedbackadd.php:0

( ! ) Notice: Undefined index: comments_input in C:\wamp\www\test\feedbackadd.php on line 19
Call Stack
# Time Memory Function Location
1 0.0012 256400 {main}( ) ..\feedbackadd.php:0




This is the PhP code


<?php

//the example of inserting data with variable from HTML form
//input.php
$connection = mysql_connect("localhost", "root", ""); //database connection
if (!$connection) {


$db_found = mysql_select_db("fillform");
die('Could not connect: ' . mysql_error());
}

$db_found = mysql_select_db("fillform");

$firstname = trim($_POST['firstname_input']);
$lastname = trim($_POST['lastname_input']);
$emailaddress = trim($_POST['emailaddress_input']);
$telephonenumber = trim($_POST['telephonenumber_input']);
$comments = trim($_POST['comments_input']);


//inserting data order
$sql_command = "INSERT INTO fillform (firstname, lastname, emailaddress, telephonenumber, comments) VALUES('$firstname','$lastname','$emailaddress','$telephonenumber','$comments')";

//declare in the order variable
$result = mysql_query($sql_command); //order executes
if ($result) {
echo "<br>Input data is \"succeed\"";
} else {
echo("<br>Input data is fail");
}

mysql_close($connection);
?>



This is the HTML code

<!DOCTYPE HTML>
<html>

<head>
<title>Feedback</title>
</head>

<body>
<table border="1">

<tr>
<td>
<table>
<form method="post" action="feedbackadd.php">

<tr>
<td>First Name</td>
<td><input type="text" First Name="firstname_input" size="40">
</td>
</tr>

<tr>
<td>Last Name</td>
<td><input type="text" Last Name="lastname_input" size="40">
</td>
</tr>

<tr>
<td>Email Address</td>
<td><input type="text" Email Address="emailaddress_input" size="40">
</td>
</tr>

<tr>
<td>Telephone Number</td>
<td><input type="text" Telephone Number="telephonenumber_input" size="40">
</td>
</tr>

<tr>
<td>Comments</td>



<td><input type="text" Comments="comments_input" size="40">



</td>

</tr>









<tr>
<td></td>
<td align="right"><input type="submit"
name="submit" value="Sent"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Appreciated your help.
prosate
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 12, 2013 5:45 pm

Re: Undefine index php (HELP)

Postby johnj » Tue Mar 12, 2013 8:52 pm

johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Undefine index php (HELP)

Postby seandisanti » Wed Mar 13, 2013 2:23 pm

it looks like you may have had a find and replace go awry on you. look at your input tags.
<input type="text" First Name="firstname_input" size="40">
if your inputs aren't properly setup and named, then the data will never go the way you expect it to. also you can always verify what's coming over with
Code: Select all
if ($_POST){
echo '<pre>';
print_r($_POST);
}
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 787
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

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