Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Supress Errors At The Page Level? Undefined Index Errors.


I'm creating a simple reply form, and if a form item isn't answered I
get an error:
"Notice: Undefined index: rb_amntspent in
c:inetpubwwwrootmackinawsurvey.php on line 36"
even if in the code I allow for an unselected item. (Code at the
bottom here.)
It works fine otherwise.

Now in the past I've made a change to php.ini to repress errors, but
for this project I don't have access to the php.ini.
Is there a way to supress errors on that page for that session?

Or, is there a way to just not get that error at all?

Here's a sample of the code that gets the form response. If an item is
selected, no error for that question, but if an item is not selected I
get the error above even though I still get a successful echo for the
"else" or "default" option which occurs if nothing is selected:

$rb_visited = $_POST["rb_visited"]; //Have you ever visited Mackinaw
City, Michigan?
if ($rb_visited == "1") {
$rb_visited_reply = "Yes";
} elseif ($rb_visited == "0") {
$rb_visited_reply = "No";
} else {
$rb_visited_reply = "You did not answer this question";
};

$rb_lastvisit = $_POST["rb_lastvisit"]; //When was your last visit to
Mackinaw ity?
switch ($rb_lastvisit) {
case "1":
$rb_lastvisit_reply = "Earlier this year (2003)";
break;
case "2":
$rb_lastvisit_reply = "Last year (2002)";
break;
case "3":
$rb_lastvisit_reply = "2 years ago (2001)";
break;
case "4":
$rb_lastvisit_reply = "3 years ago (2000)";
break;
case "5":
$rb_lastvisit_reply = "4 or more years ago (1999)";
break;
default:
$rb_lastvisit_reply = "You did not answer this uestion";
}




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Undefined Index/variable Errors?
I have no idea why my variables are not being sent to the server. With php 4.3.1, Apache 2.0.44 and MySQL, the following script PHP Code:

Keep Getting Undefined Variable Errors -
PHP,

I am using the examples in the book:
PHP: Your Visual Blueprint For Creating Open Source, Server Side Content

In the section where they talk about getting values from a form
submission, the book says:

"PHP makes it easy to process data from a form. When a PHP
page receives form information, the page automatically converts
the names of form elements to PHP variables, and assigns
the data entered in the elements to the variables"

So I try to display what was submitted, but I get an undefined
variable error.

For example,

<? php
print "the ID you entered was: ";
print $userid;
?>

This returns an error. But, if I use the following it works:

<? php
print "the ID you entered was: ";
print $HTTP_POST_VARS['userid'];
?>

Can someone explain this?

One more example:

I'm trying to simply display a session ID (using the example in the book):

<?php
session_start();
?>

<html>
<head>
<title>PHP Session Test</title>
</head>
<body>

<?php
print "The session ID is: ";
print $PHPSESSID;
?>

</body>
</html>

When I access this page I get:

The session ID is:
Notice: Undefined variable: PHPSESSID in c:inetpubwwwrootsessiontest.php
on line 13

How To Define Variables And Avoid Undefined Variable Errors?
how does one set a variable so as to avoid errors like this:

Notice: Undefined variable: arrayToCapture in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/pdsIncludes/McControllerForAll.php
on line 922

Placing Errors On The Page
I have code below (due to length I only included a portion). I am
validating an email address. It checks to see if the email field is
blank, in the proper format, etc... It prints errors to the screen and
everything works perfectly, but the errors always print at the very
top of the page and I am having difficulty moving those errors around
so they fit nicely into the page design I have. Rather than printing
the errors I tried assigning them to variables and printing them
elsewhere on the page, but it didn't work and the errors did not try
at all. I also tried moving the function to a different part of the
page where the errors would print where I wanted them, but I had the
same problem as with the variables. I'm kind of in a bind and need
this done asap. Does anyone have any thoughts on this?

<?php
function process_form() {

global $db;

$firstName = addslashes($_POST['firstName']);
$lastName = addslashes($_POST['lastName']);
$email = $_POST['email'];
$emailHash = md5($email);
$active = "n";

// Check syntax
$validEmailExpr = "^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$
%&_-])*" .
"@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*
$";

// Validate the email
if (empty($email))
{
print "The email field cannot be blank";
return false;
}
elseif (!eregi($validEmailExpr, $email))
{
print "The email must be in the name@domain format.";
return false;
}
elseif (strlen($email) 30)
{
print "The email address can be no longer than 30
characters.";
return false;
}
elseif (function_exists("getmxrr") &&
function_exists("gethostbyname"))
{
// Extract the domain of the email address
$maildomain = substr(strstr($email, '@'), 1);

if (!(getmxrr($maildomain, $temp) ||
gethostbyname($maildomain) != $maildomain))
{
print "The domain does not exist.";
return false;
}
}

$db->query('INSERT INTO users (firstName, lastName, email, hash,
active)
VALUES (?,?,?,?,?)',
array($firstName, $lastName, $email, $emailHash,
$active));

$message = "
Thank you for signing up for the . Please click on the link below
to confirm your registration. If the link is not active, copy-and-
paste it into your browser window.

http://www.EmailCapture/validateSuccess.php?id=$emailHash
";

$subject = "";
$from = "";

mail("$email", "$subject", "$message", "From: $from");

print "<script>window.location=..

Errors Validating XHTML Page
I've been validating some pages as XHTML 1.0 using the W3C HTML Validation Service.
(http://validator.w3.org/) I've come across 2 familiar snippets of PHP code that make it ack, and have had no luck resolving it! Code:

No Errors, Just Blank Page - Error_reporting(E_ALL)
Hey people. I have a strange problem. I never get any errors, just blank pages. Even if I insert error_reporting(E_ALL); . Is there an INI setting that I am missing?

Blank Page Caused By Undefined Index
I upgraded my php from 4.4.7 to 5.2.4 and now the entire website doesn't work.  So I am trying to learn PHP and go through the site one error at a time.  If you have a idea why the upgrade caused the site to fail that would be great.

But in the meantime this is the problem i am stuck on.

I get this error now when transferring to a page

Notice - PHP Notice: Undefined index: REMOTE_ADDR in c:locationSession.php on line 45.

That line has the following code.

$GLOBALS["$SessionName"]=md5 (microtime() . $GLOBALS[REMOTE_ADDR"]);

Like I said this code worked before the upgrade.  Any idea what I can do to fix this problem?

Detecting 404 Aqnd Other Page Errors On A Remote Website
Is it possible to detect page errors such as 404 (page not found)? I've searched good but can't find anything, or i'm not looking in the right places.

If so, would you be able to detect it even if a htaccess redirects it to an error page?

Validation Errors From Displaying On Form Page Load Instead Of Submit
creating two forms and they work fine. Problem is that the validation errors display immediately on page load instead of on submit. Here's the full code for the form parsing: Code:

Index.htm Going To Login Page And Sending Back To Index Page
1: A visitors visits a.html page. decides to login and post comment. goes to login page and logs in then I want to send him back to a.html page how do I do that? Here is my login page and login.php page.

2: Same as above but I want to send them back after some time... while I make them view the error, why they have not been able to login. Code:

Errors In Php 5.0.4 Not In 4.3.10-16
I use the following statements:

$var = "";
$var = $_POST('varname');

In php 4, when 'varname' was not defined, $var remained an empty string;
In php 5, I suddenly get errors.

I solved these by including the function array_key_exist to check the
occurence of 'varname'
Is this the prefered way or is ther a better solution?

Errors In Php 5.0.4 Not In 4.3.10-16
I use the following statements:

$var = "";
$var = $_POST('varname');

In php 4, when 'varname' was not defined, $var remained an empty string;
In php 5, I suddenly get errors.

I solved these by including the function array_key_exist to check the
occurence of 'varname'
Is this the prefered way or is ther a better solution?

PHP 404 Errors
Some of my visitors keep emailing me about "404 page errors" on my website even though the pages are working perfectly. I have had this problem before , I figured it out and it was because of my "generators" which uses pure PHP codings like this - http://www.generators.hot-lyts.com/linkgen.php.

I had the solution, I made a sub domain and since then I wasn't getting anymore error mails however it occurs again, I have checked the new pages I've added recently and deleted some of them but I still have no luck, I still get tons of mails about this error pages and it is really frustrating because my hits have been dropping big time.

I really have no idea what the problem is with my website. I am not sure if it's my server or some php problems. Code:

Ereg_replace - Errors
Whenever I use the ereg_replace function like follows:

Connection Errors ?
host -{ The server }- is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'

anyone know why this message show up allot of times and goes away only after restarting mysql and apache ? is there a other way if fixing this ?

Odbc Errors
I am using php and sybase as a backend. To connect to sybase I am using odbc connections. the odbc connection is working fine but when I run an sql statement i get the following error:

" Warning: Supplied argument is not a valid ODBC-Link resource "

I am using an external file which holds my connection function which is:
function db_connect()
{
global $dbhost, $dbusername, $dbuserpassword, $defaultdbname, $dsn;
$myConnection = odbc_connect($dsn, $dbusername, $dbuserpassword) or die("Unable to connect to Server");
}

$myConnection = db_connect();
echo "Connected";

$mySql = "Select * from branch";
$myResult = odbc_prepare($myConnection, $mySql) or die("Could not prepare Statement");
odbc_execute($myResult) or die("Could not execute Statement");

odbc_free_result($myResult);
odbc_close($myConnection);

I get an error after the sql query. Can anyone please tell me what's wrong with this?

PHP Install Errors
I want to install Twig for web email which requires apache and php so I've installed all the right stuff but it still fails. Error_log output:

[Fri Feb 16 11:57:07 2001] [info] Server built: Feb 15 2001 11:38:09
[Fri Feb 16 11:58:46 2001] [error] (8)Exec format error: exec of /var/www/htdocs/index.php3 failed
[Fri Feb 16 11:58:46 2001] [error] [client 134.202.1.235] Premature end of script headers: /var/www/htdocs/index.php3

I configured Apache using the commandline: Code:

Bcompiler Errors
I am getting these errors all the time now, on multiple scripts at random
times.

Warning: bcompiler: Bad bytecode file format at 00000000 in Unknown on line
0

This tells me it has to be PHP in some fashion.

Display Errors Is Both On And Off
I have a website in which PHP errors are displayed, despite having them
configured to not display.

Here is a test file I created to explore this:

<?php
echo ini_get( 'display_errors' );
phpInfo();
?>

The ini_get says "On", the phpInfo says "Off" (for display_errors in the PHP
Core section).

PHP 5.0.4

I'm struggling to understand how, at runtime, I get these conflicting
reports. The configuration files all say display_errors is OFF, and phpInfo
agrees, but PHP acts like they are on, and ini_get shows why.

Displaying Errors
php_info(); for display_errors variable says: Off, Off. I tried the
error_reporting(E_ALL);, but nothing happens. If I have an error
somewhere, PHP just silently dies, no output whatsoever. Which variable
has to be set so that error_reporting() function works, but no
errors/warnings are displayed if the error_reporting() wasn't executed
(admins don't want to have display_errors On globally)? PHP Version is
4.3.3.

--

Trapping Errors
Is there a clean way to trap errors in PHP?
In Perl there is eval { <code> } and a special variable that can be
checked to see if the execution of the code was successful or not, and
thus a clean way to trap the error without it killing the entire
script.

Is there something similar in PHP?

How Do I Get MySQL Errors?
I just started going from ASP to PHP about a week ago, and I'm absolutely loving it, but what is up with PHP and MySQL errors? When I insert data with a mysql_query() and nothing gets inserted, I have no way of knowing what went wrong. Where are the errors?

Errors Using Php And Perl
I'm trying to intergrate a cgi affiliate tracking system into a php
website. When someone pays using PayPal it's supposed to direct them to one
page if the payment is a success or another if payment failed. This is the
code:

if($action == order && $order_n != "")
{

include "engine/card_process.pml";

if($payment_status == success)
{
$page = payment_success;
}
else
{
$page = payment_failed;
}
}
I'm trying to insert code into this process that will credit the affiliate
the correct amount if the process is a success. This is the code that's
supposed to be inserted to credit affiliates:

<img src="http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=
$amount" border=0>

I tried inserting this before the line "$page = payment_success;" in
various forms, but I either get errors, or the affiliate isn't credited, or
both. I managed to get the code to credit affiliates correctly, by
inserting this:

include "<img src='http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?
payment=$amount' border=0>";
but it also gives me errors:

Warning: main(): failed to open stream: No such file or directory in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Warning: main(): Failed opening '<img src='http://www.yoursite.com/cgi-
bin/affiliates/sale.cgi?payment=0.01' border=0>' for inclusion
(include_path='.:/usr/share/pear') in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: Cannot modify header information - headers already sent by (output
started at /home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 69

Line 18 is the inserted code, line 29 is:

session_start();

Line 69 is:

setcookie("current_page"' $page);

If you can help me I would appreciate it. I really don't have a clue about
what I'm doing. I'm just guessing. Also, the email address is valid.
Address harvesters are programmed to ignore email addresses that contain
the word "fake".

Errors With $_SESSION
the website i'm creating will block "guest" users to some sections of the site. when "guest users" go to "download" page it will show an alert window. logged in members have the access to download page.

in "login.php", i create a $_SESSION var, each member has their own level, depending on the type of features they want;

$_SESSION['mylevel'] = $member_info['level'];
the checking of level to show the alert window is this: Code:

if (($_SESSION[mylevel']=='')||($_SESSION['mylevel']==&#399;')) { ?>
<SCRIPT LANGUAGE=JavaScript>
var agree=alert('Please login first.');
window.location='http://www.mywebsite.com'
</SCRIPT><? }

problem is like this; as a guest user, i go to "download" page, the alert window shows up, saying "please login first". (that's ok) when i log in, then go back to "download" page it still shows the alert window. i have to close the browser first then go to "download" page before its accessible.

WhereBisDu Errors
I have installed WhereBisDu on phpNuke 7.0 and it seems to work well. The problem I am encountering is when I scroll down to the bottom of the Forum page, I see these errors. I see no where in the php scripts where I need to put in SQL information. what am I missing: Quote:

Warning: mysql_query(): Access denied for user: 'XXXXX@localhost' (Using password: NO) in /var/www/html/modules/WhereBisDu/wbdtrack.php on line 36

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/modules/WhereBisDu/wbdtrack.php on line 48

Warning: mysql_query(): Access denied for user: 'XXXXX@localhost' (Using password: NO) in /var/www/html/modules/WhereBisDu/wbdgeo.inc on line 188

Code:

No Errors ( Mysql )
<?php
echo "a href="index.php?alp=a">A</a> ] "
."- [ <a href="index.php?alp=b">B</a> ] "
."- [ <a href="index.php?alp=c">C</a> ] ";

if (isset($_GET['alp']))
{
// Now what must i make the sql statment so that it will display all
the names that starts with a $_GET['alp'] ( a ) //
// and if i use like then it will display all names that has a 'a'
some where in the word. //

$sql = "SELECT * FROM store_items WHERE name = '$sid'";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result))
{
$name = $row[name];
}
}
?>

How To Get Errors From Exec?
I am running PHP 4 and this code is failing, in that it does not
insert the records into MySQL

// Upload the data to file to the db.
exec("mysqlimport --replace --fields-terminated-by=','
--fields-optionally-enclosed-by='"' --user=$db_user
--password=$db_password --host=$db_hostname
--lines-terminated-by='
' $db_name $new_src_file_path", $output,
$return);

Sadly, the $output array is empty, but the $return value is 127. Does
anyone know what that means or how I can get more meaningful error
output?

Phpgroupware On Iis Errors
i'm trying to install phpGroupWare on Win2k running IIS 5. I know i
should be using Apache, but this is what my current conditions limit
me to due to other projects and applications that have to be on IIS. I
have been running into problems left and right. Lots of them were
fixed with the php.ini fix of register_global = on . i am still
getting tons of error and every single one is Undefined something or
other. moslty Undefined index with a few Undefined properties, classes
and functions sprinkled throughout. i'm hoping that the new verson of
PHP had somethin done in the ini file, similar to the
register_globals, that would change something about defining
variables. If anybody has any insight,

Errors To Stderr
I want to write all produced error messages (error, warning, notify,
etc...) to STDERR.
Is this possible without writing my own error handling routine?

FastTemplate Errors
I'm attempting to use the PHP FastTemplate class, and am running into trouble right away. I'm using the latest version of the template code, and PHP 4.0.6. Code:

Socket Errors
I'm looking through a complex script at the moment.
If the OS is FreeBSD, the script defines EINPROGRESS to error 36 (Operation
now in progress), EALREADY to error 37 (Operation already in progress), and
EISCONN to error 56 (Socket is already connected). If it's Linux, then sets
them to 115, 114 and 106 respectively. I want to try and add Windows
compatability to this code. I've printed a list of all Windows socket error
codes from 0 to 15000, but can't find the similar errors,

Errors In Php/mySQL
I wonder if there is any command to hide
php and mySQL errors from the user, and replace
them with a customized message, en maybe even
send a mail with the error to a defined email adress..

Fsockopen Errors
In the code fragment below $errno and $errstr get set to the
system-level errno and strerror() from the connect() call. Does anyone
know what the errors below mean an how I may rectify them?

$fp = fsockopen($host, $port, $errno, $errstr, 30);

Here are the resulting errors I get regardless of what I specify for
$host:

$errno = "115"
$errstr = "Operation now in progress"

Session Errors
I've got a Php 4.3.3 installation on A Red Hat Advanced Server 2.1.

Sessions start correctly if i start them from the server root.
But, if i start the session on a sub-folder, when i change to a folder
that's not below it, the session gets started again.

Let's see an example

When i begin from the document root all goes as expected...
Open /index.php -> session id = A
Open /folder1/index.php -> session id = A
Open /folder2/index.php -> session id = A

But when i begin on a subfolder.......
Open /folder1/index.php -> session id = A
Open /folder1/index2.php -> session id = A (inside the same folder the
session is mantained)
Open /folder1/subfolder/index.php -> session id = A (on a sub-folder the
session is also mantained)
Open /folder2/index.php -> session id = B (on a folder that's not below
the first, the session starts again!!!!!!!!)
Open /folder3/index.php -> session id = C

It's like if the session were only set for the current path and downwards,
but not the entire server...
Any thoughts?

Mysql Errors
I've run a php script that uses mysql databases without problems
on one server, but then I changed web hosts and installed it the same
way buy I get a lot of errors which are all derived from the
script not being able to interact with the database.
It finds the database and connects, but then can't do anything else.
When it uses a database on a different server, things work fine,
so I'm guessing it's just a mysql error and not the fault of the script.

PHP Does Not Report Errors!
I have no idea how this happened, but PHP (5.1.2) on my dev server
stopped telling me about errors. There's nothing in the server log
either.

I redownloaded PHP and used php.ini-recommended (only setting
display_errors = On). After restarting, it still returned blank pages
rather than error messages.

So I deleted php.ini and restarted the server, and suddenly error
reporting came alive!

Where have I buggered up?

PHP Startup Errors
i'm using pHP 5.2.1 after much effort i've managed to get it to work in IIS and it can pull data out of mysql database that was installed with xampp. now the xampp has a php 4 in there - using that for other java/apache projects - cant remove it.

thing is - when i start up my machine or i restart the IIS service, i'm getting a whole bunch of PHP Startup error message, mostly to do with not being able to load dynamic libraries. I've configure the php.ini file in terms of the ext etc, set up my environment variables etc.

Odd Forbidden Errors
Not sure if this is PHP or .htaccess errors but for some odd reasons certain rewritten URLs on my forum work, and others don't. They all work for me, but for some people they have reported "Forbidden" server errors. I'm stumped at what it could be.

Example of a working URL
Example of a "Forbidden" URL

I have attached my .htaccess file's contents below in case it is being caused by it: Code:

Require_once() Errors
Im making a website and i am writing a php script for a register form. The script checks for required fields if a required field is missed out then a error is generated. I think the problem might be on the server site.

There errors i am getting are

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/Connections/userlogin.php) is not within the allowed path(s): (/tmp:/usr/share/pear:/home/fhlinux169/m/maltmandarkblues.co.uk/user) in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2

Warning: require_once(/Connections/userlogin.php) [function.require-once]: failed to open stream: Operation not permitted in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '/Connections/userlogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2

The code:

HIDE Errors?
I used a show error code once, can't remember which, but now I've looked at my site, every error on every page is showing, including undefined variable errors (partly because they're defined by forms on that page). So how do I hide all errors?

Session Errors
Im trying to call a session via session_start(); in a script, and im getting this error.

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/frozen/public_html/fg/index.php:8) in /home/frozen/public_html/fg/ses.php on line 11

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/frozen/public_html/fg/index.php:8) in /home/frozen/public_html/fg/ses.php on line 11
PHP version 4.4.6

Catching Errors?
I am having trouble wrapping my head around the general concept of catching errors. I have read the tutorials about exceptions on DevShed, as well as on Zend's website. It is still not clear to me. If I throw 5 exceptions, how come I need 5 catch phrases, and what does it mean when it travels up the stack?

Sorry I am just really confused with the catch phrases and how they work, although I am almost positive I completely understand the throwing of exception concept.

Fatal Errors
I'm getting this rather ugly error when i try to use the same include more than once:

Fatal error: Cannot redeclare resize_png_image() (previously declared in path/backup+.php:189) in path/backup2.php on line 189

Is there anything I can do to stop it happening? - I need to re-use this include anything up to 50 times on a page.

XAMPP Errors
I Installed XAMPP, and it doesn't display errors in my PHP, can you help me?

PHP Not Reporting Errors
Ive tried editing the .ini, and manually setting on run time. Here is a test script I whipped up to make it throw an error to see if it reports:

<?php
error_reporting(8191);
echo "text"
?>

Now it should obviously say compile error for the lack of a ;. But it dosnt. Any ideas why?

Undefined Index

Notice: Undefined index: name in F:uniSoftware
engineeringassignment4guestbook.php on line 6

the variable $name is declared as $name = _POST["name"];

What could be causing this?

I've recently installed php 5 on IIS with mysql 4. All running on windows XP

downloaded code straight from my uni's tute site.

went to run it and it sort of runs but I get these errors at the top of the
page.

Undefined Index
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?

Undefined Index
I have a simple search feature that searches 3 fields in 3 separate tables
in a MySQL db, and I'm getting an 'undefined index' error, but only in the
first section (first table)of the results. The undefined index is tied to
the docs.projID in the "if ($row_search['docs.projID'] == 1)". This if
statement is there to control to format of the link as pages are in
different depths of subfolders depending on security needs. Googling this
sort of error seems to reflect problems with the $_POST['keyword'] not
existing when the results are first listed, so I moved the PHP results code
from it's own page (search.php) to the main page, which didn't help. I have
tried several different things and can't seem to get it working right. Here
is what I have:

Form:
<form id="search" name="search" method="post" action="<?php echo
$currentPage?>">
SEARCH<br />
<input name="keyword" type="text" size="20" value=""/>
<input type="image" name="Submit"
src="images/team_icon_go_btn.gif" />
</form>

Results:

<?php if (isset($_POST['search']))
{
$keyword = $_POST['keyword'];

mysql_select_db($database_website, $website);
$query_search = "SELECT Distinct docURL, docTitle, docDesc, docs.projID,
groupCode, projCode, catName FROM docs
JOIN subcat on subcat.subcatID=docs.subcatID
JOIN cat on cat.catID = subcat.catID
JOIN groups on groups.groupID=proj.groupID
JOIN proj on proj.projID=docs.projID
WHERE proj.projID=docs.projID AND docURL LIKE '%$keyword%' OR docTitle LIKE
'%$keyword%' OR docDesc LIKE '%$keyword%'";
$search = mysql_query($query_search, $website) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
$totalRows_search = mysql_num_rows($search);
$proj = $row_search['projCode'];
?>
<?php if ($totalRows_search < 1)
{
echo "No internal documents matched your request.";
}

else {?>

<p><table width=95%>
<tr><td colspan="3"><font size="+1">Internal Documents:</font></td>
</tr>
<tr>
<td><strongLink </strong></td>
<td<strong>Description</strong></td>
<td<strong>Project </strong></td>
</tr>
<?php
do { ?>
<tr>
<td>
<a href="<?php if ($row_search['docs.projID'] == 1) {
echo $row_search['catName']."/".$row_search['docURL'];
}
else {
echo
$row_search['groupCode']."/".$row_search['projCode']."/".$row_search['catName']."/".$row_search['docURL'];
?>"><?php echo $row_search['docTitle'];
} ?></a></td>
<td><?php echo $row_search['docDesc']; ?></td><td><?php echo
$row_search['projCode']; ?></td>
</tr>
<?php } while ($row_search = mysql_fetch_assoc($search)); ?>

</table>
<?php }?>
</p>
<?php
mysql_select_db($database_website, $website);
$query_search = "SELECT Distinct toolURL, toolName, toolDesc, tools.projID,
projCode FROM tools
JOIN proj on proj.projID=tools.projID WHERE toolURL LIKE '%$keyword%' OR
toolName LIKE '%$keyword%' OR toolDesc LIKE '%$keyword%'";
$search = mysql_query($query_search, $website) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
$totalRows_search = mysql_num_rows($search);

?>
<?php if ($totalRows_search < 1)
{
echo "No tools matched your request.";
}

Undefined Index: Id
I have a website online which I have taken offline to work on it, but when I load the pages, I get the error

Notice: Undefined index: id in C:wwwwebconnectwebsitedata.php on line 5 Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved