Search the Community
Showing results for tags 'notice'.
-
<form name=\"form1\" ACTION=\"$_SERVER[REQUEST_URI]\" METHOD=\"POST\">Your First Name<br><input name=\"first\" value = \"$first\" type=\"text\" id=\"first\" size=\"25\"><br><br>Last Name<br><input name=\"last\" value = \"$last\" type=\"text\" id=\"last\" size=\"25\"><br><br>Email<br><input name=\"email\" value = \"$email\" type=\"text\" id=\"email\" size=\"25\"><br><br>Telephone Number<br><input name=\"phone\" value = \"$phone\" type=\"text\" id=\"phone\" size=\"25\"><br><br><label for=\"comments\">Comments</label><textarea name=\"comments\" cols=\"18\" rows=\"4\" class=\"txt\" id=\"comments\"></textarea><div style=\"visibility:hidden\"><input name=\"email2\" type=\"text\" size=\"45\" id=\"email2\" > </div><input type=\"submit\" name=\"Submit\" value=\"Submit\" class=\"tpc4\"></form>\n"; Hi I am getting the error message Notice: Undefined Index on the following form before submission I would like to fix this rather than suppress errors Any help would be much appreciated
-
hi, can anyone tell me anything wrong with my coding as it keeps mentioned undefined index,id tambahitem.php
-
Hi all, I browsed through various forums looking for a solution to the problem i am facing. i came upon a few similar problems others were facing but solution to their code does not seem to work with my code. i'll be grateful if someone could please point me in the right direction. This is the notice that my browser shows me- Notice: Undefined variable: subject in C:\wamp\www\.....\sendemail4.php on line 69 Call Stack #TimeMemoryFunctionLocation 10.0010247784{main}( )..\sendemail4.php:0 "> Also, please find attached a screenshot of what i am getting after running the php script in my localhost. Here's the code from Head First php mysql book chapter 4 that i am trying to run- <html> <head> <title> Make Me Elvis - Send Email </title> </head> <body> <p><strong>Private:</strong> For Elmer's use only <br /> Write and send an email to mailing list numbers.</p> <?php //Detecting form submission using isset() function //Making forms sticky if (!empty($_POST['submit'])) { $from = 'prasadwalvekar@yahoo.com'; $subject = $_POST['subject']; $text = $_POST['elvismail']; $output_form = false; if( empty($subject) && empty($text) ) { //Both $subject and $text are blank echo 'You forgot the email subject and body text'; $output_form = true; } if( empty($subject) && !empty($text) ) { //$subject is empty and $text is not empty echo 'You forgot email subject.'; $output_form = true; } if( !empty($subject) && empty($text) ) { //$subject is not empty and $text is empty echo 'You forgot email body text.'; $output_form = true; } } else { $output_form = true; //if form's never been submitted, show it! } if((!empty($subject)) && (!empty($text))) { $dbc = mysqli_connect('localhost', 'root', '', 'elvis_store') or die('Error connecting to MySQL server.'); $query = "SELECT * FROM email_list"; $result = mysqli_query($dbc, $query) or die('Error querying database'); while ($row = mysqli_fetch_array($result)) { $to = $row['email']; $first_name = $row['first_name']; $last_name = $row['last_name']; $msg = "Dear $first_name $last_name, \n $text"; mail($to, $subject, $msg, 'From:' . $from); echo 'Email sent to: ' . $to . '<br />'; } mysqli_close($dbc); } if ($output_form) { ?> <form method="post" action="<? php echo $_SERVER['PHP_SELF']; ?>"> Subject of email: <input type="text" name="subject" value=" <?php echo $subject; ?> "><br /> Body of email: <textarea name = "elvismail" rows="8" cols="40"><?php echo $text; ?></textarea><br /> <br /> <input type = "submit" name = "submit" /> </form> <?php } ?> </body> </html>
-
Hey guys, i am working on my site , and i have a global conditional that is pretty simple in what i want it to do , i have 4 variables that are not always set, i am writing an if elseif statement to see if whichever variable is used to then continue to its specified query/ if ($current_file == 'profile.php') { $mid = $_GET['male_id']; $fid = $_GET['female_id']; $serid = $_GET['series_id']; $id = $_GET['id']; if(isset($mid) === true){ $query = "SELECT * FROM `content` WHERE `id` = $mid"; }elseif (isset($sid) === true) { $query = "SELECT * FROM `content` WHERE `id` = $sid"; }elseif(isset($serid) === true){ $query = "SELECT * FROM `content` WHERE `id` = $serid"; }elseif(isset($id) === true){ $query = "SELECT * FROM `content` WHERE `id` = $id"; } $info = mysql_query($query); while($row = mysql_fetch_assoc($info)){ extract($row); } } now the conditional works fine , in terms of the query working and grabbing the desired data and parlaying that data onto the site. My issue is simply , i want to leave error reporting on for my users, so that if there are errors or problems i dont know of , server side , they can report this to me. When i do this, i get : any explanation as to why this is happening ? edit: i understand as to "why" , the variable that is the $_GET is now set to $sid , and the 3 other variables are not defined with since they are not in the URL. should i set the variables deeper into the conditional ? are they too global to where the entire if statement which is looking for current file and need to be set in their own if statements ? also , any suggestions on how to alter my code to provide the same results without the notice being portrayed ? much appreciated guys
-
i m new in php i make two pages first was first.php the second was insert.php the codes are below but it show Notice: Undefined index: how to remove this error thanks first page <!DOCTYPE html> <html> <body> <form id="firstform" action="insert.php" method="post"> <center> My First Page in PHP </center> <center>Name:<input type="text" id="name" size=20> FatherName: <input type="text" id="fname" size=20> Address:<input type="text" id="add" size=20> <input type="submit" name="sub"> </form> </body> </html> insert page <html> <body> <?php $con=mysqli_connect("localhost","root","khan","first"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO bio(name, fathername , address) VALUES ('$_POST[name]','$_POST[fname]','$_POST[add]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); ?> </body> </html>