You are here: Undefined Index « PHP Programming Language « IT news, forums, messages
Undefined Index

Posted by Dave Kelly on 09/20/06 03:41

Reference the above thread: "Passing a HTML variable to a PHP file
using include". One thing I've learned over the years is that an error
doesn't always come from where the compiler/interperture says it does.
Case in point maybe.

I am getting this error:


Notice: Undefined index: var1 in
/var/www/vhosts/texasflyfishers.org/httpdocs/form.php on line 4

Warning: fwrite(): supplied argument is not a valid stream resource in
/var/www/vhosts/texasflyfishers.org/httpdocs/form.php on line 5

Warning: fclose(): supplied argument is not a valid stream resource in
/var/www/vhosts/texasflyfishers.org/httpdocs/form.php on line 6

in this function:

<?php
if($_GET["op"] == "ds") {
foreach ($_GET["name"] as $key=>$value) {
$fp=fopen($_GET["var1"],"a");
fwrite($fp,$_GET["name"][$key] ."&nbsp;". $_GET["email"][$key]
.."&nbsp;". $_GET["phone"][$key] ."&nbsp;". $_GET["id"][$key]);
fclose($fp);
}
}
?>

'var1' comes from this last line in this snippet in a previous function:

<html>
<body>
<?php include ($_GET["var2"]); ?> // this works
<br clear="all">
<?php include ($_GET["var1"]); ?> //this works
<form action="form.php?var1=>($_GET["var1"])" method="GET"> // NOT

I have found that the text editor you are using will color out the
parts of code if they are correct. This code does not color out evenly.
In the 2 'include' statements '$_GET' is red. In the 'form action'
statement it is not.

At this point 'var1' is a name on a disk with zero length. Is it
possible that the error trapping of the 'include' function is taking
care of this and the error trapping of the 'fopen' alerts you that it is
going to crash fwrite because 'var1' is now corrupted?

I'm clueless, can anyone help?
Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация