Undefined Index

Alles, was PHP betrifft, kann hier besprochen werden.

Undefined Index

Postby Mehak » 02. July 2013 17:06

Hi Friends
I'm using xamp to develop a php application. My problem is that everytime I call a variable that sometimes happens to not have a value, I get an error that says it's an undefined index.
This is my source code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Find and Replace</title>

<center><h1 style="color:#C6F">Find And Replace</h1>
<form action="findandrep.php" method="post">
Find: <input type="text" name="text" />
Replace: <input type="text" name="text1" />
<br />
<textarea name="text2" rows="15" cols="30"> </textarea>
<input type="submit" name = "submit" value = "Go" />


for($i=0; $i<strlen($string) ; $i++){

if($text == $Find){

echo $text;

Notice: Undefined index: text in C:\xampp\htdocs\myphpsite\String Function\findandrep.php on line 25

Notice: Undefined index: text1 in C:\xampp\htdocs\myphpsite\String Function\findandrep.php on line 26

Notice: Undefined index: text2 in C:\xampp\htdocs\myphpsite\String Function\findandrep.php on line 27
Posts: 6
Joined: 30. June 2013 13:36
Operating System: windows 7

Re: Undefined Index

Postby Altrea » 02. July 2013 17:42

Hi Mehak,

This way please:

Best wishes,
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 9264
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest