473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PLEASE HELP - Very odd problem

I am new to PHP and I am having a very odd problem. Could some PHP
guru please help.

I am passing some variables from one page to the next, and in the
starting page, I have:

<div id="navigation" align="center">
<form NAME="addnewpoetpoemform" METHOD="GET"
ACTION="addpoetpoem.php">
<table align="center">
<tr>
<td width="20%">Poet Name:</td>
<td width="80%"><input TYPE="text" NAME="newpoet" SIZE="30"
MAXLENGTH="30"></td>
</tr>
<tr>
<td width="20%">Poem Name:</td>
<td width="80%"><input TYPE="text" NAME="newpoem" SIZE="30"
MAXLENGTH="30"><$
</tr>
<tr>
<td align="center"><input TYPE="SUBMIT" VALUE="Add Poet and
Poem"></td>
</tr>
</table>
</form>

When the receiving page opens I can see, in the URL text box the
values that have been passed in.
However, I am unable to echo these values. If I have:
<table>
<tr>
<td>
<?php
// import_request_variables(gP,"");
$recdpoet=$_GET['newpoet']
$recdpoem=$_GET['newpoem'];
if(isset($recdpoet) and strlen($recdpoet) 0)
echo $recdpoet;
?>
</td>
</tr>

The page opens completely blank. What might be
going wrong? I have tried uncommenting the above line, but it does not
work.
Any help or suggestions will be greatly appreciated.

Mar 3 '07 #1
12 1468
Rik
cp**********@yahoo.com <cp**********@yahoo.comwrote:
I am new to PHP and I am having a very odd problem. Could some PHP
guru please help.

I am passing some variables from one page to the next, and in the
starting page, I have:
However, I am unable to echo these values. If I have:
$recdpoet=$_GET['newpoet']
You forgot to close it with ';'
Any help or suggestions will be greatly appreciated.
While developing, setting display_errors on and error_reporting to all is
a great help. If you had this on top of your page, you'd have spotted it
almost immediately:

<?php
ini_set('display_errors',true);
error_reporting(E_ALL);
?>
--
Rik Wasmus
Mar 4 '07 #2
On Mar 4, 1:05 am, Rik <luiheidsgoe...@hotmail.comwrote:
cpptutor2...@yahoo.com <cpptutor2...@yahoo.comwrote:
I am new to PHP and I am having a very odd problem. Could some PHP
guru please help.
I am passing some variables from one page to the next, and in the
starting page, I have:
However, I am unable to echo these values. If I have:
$recdpoet=$_GET['newpoet']

You forgot to close it with ';'
Any help or suggestions will be greatly appreciated.

While developing, setting display_errors on and error_reporting to all is
a great help. If you had this on top of your page, you'd have spotted it
almost immediately:

<?php
ini_set('display_errors',true);
error_reporting(E_ALL);
?>
--
Rik Wasmus
and if develop for php5 the following line might also be of interest
for your:

error_reporting(E_ALL | E_STRICT);

Cheers
Martin

------------------------------------------------
online accounting on bash bases
Online Einnahmen-Ausgaben-Rechnung
http://www.ea-geier.at
------------------------------------------------
m2m server software gmbh
http://www.m2m.at

Mar 4 '07 #3
You are missing the semi-colon after $_GET['newpoet']

To find problems like this, turn on diagnostics by adding this to the start
of your php files:
<?
ini_set("display_errors","1");
error_reporting(E_ALL & ~E_NOTICE);
?>

Big suggestion: consider using a debug environment - life will be much more
pleasant. It will take several days to set up, but I think you will find it
is well worth it. After looking at several, I use Eclipse with XDebug:

Bug 169408 - Support for XDebug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408
(be sure to locate the pdf with detailed install instructions)

Eclipse PHP Project (PDT)
http://www.eclipse.org/php

--
Mike Russell
www.curvemeister.com/forum/
<cp**********@yahoo.comwrote in message
news:11**********************@z35g2000cwz.googlegr oups.com...
>I am new to PHP and I am having a very odd problem. Could some PHP
guru please help.

I am passing some variables from one page to the next, and in the
starting page, I have:

<div id="navigation" align="center">
<form NAME="addnewpoetpoemform" METHOD="GET"
ACTION="addpoetpoem.php">
<table align="center">
<tr>
<td width="20%">Poet Name:</td>
<td width="80%"><input TYPE="text" NAME="newpoet" SIZE="30"
MAXLENGTH="30"></td>
</tr>
<tr>
<td width="20%">Poem Name:</td>
<td width="80%"><input TYPE="text" NAME="newpoem" SIZE="30"
MAXLENGTH="30"><$
</tr>
<tr>
<td align="center"><input TYPE="SUBMIT" VALUE="Add Poet and
Poem"></td>
</tr>
</table>
</form>

When the receiving page opens I can see, in the URL text box the
values that have been passed in.
However, I am unable to echo these values. If I have:
<table>
<tr>
<td>
<?php
// import_request_variables(gP,"");
$recdpoet=$_GET['newpoet']
$recdpoem=$_GET['newpoem'];
if(isset($recdpoet) and strlen($recdpoet) 0)
echo $recdpoet;
?>
</td>
</tr>

The page opens completely blank. What might be
going wrong? I have tried uncommenting the above line, but it does not
work.
Any help or suggestions will be greatly appreciated.

Mar 4 '07 #4
Mike Russell wrote:
You are missing the semi-colon after $_GET['newpoet']

To find problems like this, turn on diagnostics by adding this to the start
of your php files:
<?
ini_set("display_errors","1");
error_reporting(E_ALL & ~E_NOTICE);
?>
Since this is a syntax error, these will have absolutely no effect. The
error occurs during during parsing and before any statements are executed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 4 '07 #5
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:D7******************************@comcast.com. ..
Mike Russell wrote:
>You are missing the semi-colon after $_GET['newpoet']

To find problems like this, turn on diagnostics by adding this to the
start of your php files:
<?
ini_set("display_errors","1");
error_reporting(E_ALL & ~E_NOTICE);
?>

Since this is a syntax error, these will have absolutely no effect. The
error occurs during during parsing and before any statements are executed.
Well, then perhaps the part of my post that you deleted would be useful :-)
A debug environment will find errors like this instantly.
--
Mike Russell
www.curvemeister.com/forum/
Mar 4 '07 #6
Mike Russell wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:D7******************************@comcast.com. ..
>Mike Russell wrote:
>>You are missing the semi-colon after $_GET['newpoet']

To find problems like this, turn on diagnostics by adding this to the
start of your php files:
<?
ini_set("display_errors","1");
error_reporting(E_ALL & ~E_NOTICE);
?>
Since this is a syntax error, these will have absolutely no effect. The
error occurs during during parsing and before any statements are executed.

Well, then perhaps the part of my post that you deleted would be useful :-)
A debug environment will find errors like this instantly.
One doesn't need a debug environment to find errors like this. Simply
enabling error displays in the php.ini or .htaccess will do it just as well.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 4 '07 #7
Mike Russell wrote:
Big suggestion: consider using a debug environment - life will be much more
pleasant. It will take several days to set up, but I think you will find it
is well worth it.
I considered this, but then decided the best way to avoid those long hours
of bug hunting was to just write code that doesn't have any bugs in it. I
don't know why I never thought of that before -- all those years of
writing code with bugs in it and then debugging it -- much easier just not
to write the bugs in the first place. ;-)

More seriously, no matter how good you get at PHP, these silly little
syntax errors like misplaced brackets and missing semicolons are always
the ones that come back to bite you.

If you (not you in particular, Mike; I am referring to the general "you")
don't already have the command line version of PHP, then get it, and run
"php -l filename" on any file before you try using it. It will catch any
parsing errors in the file.

After that, enabling PHP's normal error reporting should provide fairly
helpful error messages, such as when you don't provide enough parameters
for a particular function, or if you've not implemented a particular
interface correctly, and so forth. When relevant, it tells you the exact
file and line number where the problem is. These bugs are usually fairly
simple to fix.

Then you "only" have to deal with logic errors. :-)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 6 '07 #8
Toby A Inkster wrote:
Mike Russell wrote:
>Big suggestion: consider using a debug environment - life will be much more
pleasant. It will take several days to set up, but I think you will find it
is well worth it.

I considered this, but then decided the best way to avoid those long hours
of bug hunting was to just write code that doesn't have any bugs in it. I
don't know why I never thought of that before -- all those years of
writing code with bugs in it and then debugging it -- much easier just not
to write the bugs in the first place. ;-)

More seriously, no matter how good you get at PHP, these silly little
syntax errors like misplaced brackets and missing semicolons are always
the ones that come back to bite you.

If you (not you in particular, Mike; I am referring to the general "you")
don't already have the command line version of PHP, then get it, and run
"php -l filename" on any file before you try using it. It will catch any
parsing errors in the file.

After that, enabling PHP's normal error reporting should provide fairly
helpful error messages, such as when you don't provide enough parameters
for a particular function, or if you've not implemented a particular
interface correctly, and so forth. When relevant, it tells you the exact
file and line number where the problem is. These bugs are usually fairly
simple to fix.

Then you "only" have to deal with logic errors. :-)
I agree, Tony. I always keep a test server (not available to the
outside world) with all error reporting enabled. It really saves a lot
of time!

I've tried debug environments before, and they're nice. But they're
also slow and cumbersome. I haven't found one I like well other than
Zend - but I'm not going to spend the money for it as little as I need
it. echo statements work quite well.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 6 '07 #9
"Toby A Inkster" <us**********@tobyinkster.co.ukwrote in message
news:dq************@ophelia.g5n.co.uk...
Mike Russell wrote:
>Big suggestion: consider using a debug environment - life will be much
more
pleasant. It will take several days to set up, but I think you will find
it
is well worth it.

I considered this, but then decided the best way to avoid those long hours
of bug hunting was to just write code that doesn't have any bugs in it. I
don't know why I never thought of that before -- all those years of
writing code with bugs in it and then debugging it -- much easier just not
to write the bugs in the first place. ;-)
Hi Toby,

I understand you are being tongue in cheek here, but it does touch on one of
the reasons that I believe people reject using debuggers and development
environment. Being able to type accurately and quickly write code with few
or no bugs is a high level of skill, and rightfully a source of pride. That
pride seems to be undercut by the suggestion that using a debugger would
help in any way.
More seriously, no matter how good you get at PHP, these silly little
syntax errors like misplaced brackets and missing semicolons are always
the ones that come back to bite you.
Absolutely - a nickle for the number of times I've left the single quotes
off a field name, or had a backwards if.
If you (not you in particular, Mike; I am referring to the general "you")
don't already have the command line version of PHP, then get it, and run
"php -l filename" on any file before you try using it. It will catch any
parsing errors in the file.
I appreciate your consideration, as well as your useful suggestion re the -l
option. It's nice, too, to have a red wavy line appear under the syntax
error immediately as you type it, or xtrl-space give you a selection of
function names.
After that, enabling PHP's normal error reporting should provide fairly
helpful error messages, such as when you don't provide enough parameters
for a particular function, or if you've not implemented a particular
interface correctly, and so forth. When relevant, it tells you the exact
file and line number where the problem is. These bugs are usually fairly
simple to fix.

Then you "only" have to deal with logic errors. :-)
There you go - I sense a universe of hard-earned knowledge in your use of
the word "only". Logic errors do not produce syntax errors, and knowing
where to place the echo statement often means knowing where the bug is.

Another example is learning about PHP itself, or dealing with a large
existing body of code. For example, I'm about to dive into a mature forum
system that includes 306 source files, and dozens of database tables. With
a debug environment, I can set a breakpoint at a piece of code I'm wondering
about, see all the variables (not just the ones I think I might be
interested in), and follow the chain of execution arbitrarily. These are
all very powerful abilities that I have learned are necessary for me to work
efficiently.

For me the decision of whether to use a debug environment is not even a
close call. If it's available I want it. If it's not, I'll slog along with
embedded echo's.

If you work well without a debugger, more power to you. IDE's and debug
environments are used by skilled professionals all the time, and I hope you
will forgive me if I suggest that, as experienced and productive as you are,
you would be even more productive with a *good* debug environment.
--
Mike Russell
www.curvemeister.com/forum/
Mar 6 '07 #10
Jerry Stuckle wrote:
I agree, Tony.
Jerry, surely we've been posting in the same groups for long enough by now
for you to have learnt how to spell my name?
echo statements work quite well.
function debug_them ()
{
for ( $i=1 ; $i<func_num_args() ; $i++ )
{
$val = func_get_arg($i);
if (is_array($val))
print_r($val);
else
print $val;
print "\n----\n";
}
if (func_get_arg(0)) exit();
}

usage:

debug_them(FALSE, $_SESSION, $some_array, $some_var);
debug_them(TRUE, $_POST);

The first parameter says whether the script should exit after outputting
the other parameters.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 6 '07 #11
Toby A Inkster wrote:
Jerry Stuckle wrote:
>I agree, Tony.

Jerry, surely we've been posting in the same groups for long enough by now
for you to have learnt how to spell my name?
>echo statements work quite well.

function debug_them ()
{
for ( $i=1 ; $i<func_num_args() ; $i++ )
{
$val = func_get_arg($i);
if (is_array($val))
print_r($val);
else
print $val;
print "\n----\n";
}
if (func_get_arg(0)) exit();
}

usage:

debug_them(FALSE, $_SESSION, $some_array, $some_var);
debug_them(TRUE, $_POST);

The first parameter says whether the script should exit after outputting
the other parameters.
Sorry, Toby. Believe it or not - my spell checker "corrected" your name
and I missed it. I've now added your name to the dictionary so it
doesn't happen again :-)

And yes, I use something similar, except I use a class with static
functions and a static variable. If the variable is true it prints the
info.

That way I can say something like:

Debug::setFlag(true);
Debug::dump($var);
Debug::print_r($array);

Turn things on and off with the setFlag member. And a file quick search
on Debug:: will find the references to delete them. Or I can just
create a dummy debug class which does nothing (and therefore has very
little overhead).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 6 '07 #12
Mike Russell wrote:
If you work well without a debugger, more power to you. IDE's and debug
environments are used by skilled professionals all the time, and I hope you
will forgive me if I suggest that, as experienced and productive as you are,
you would be even more productive with a *good* debug environment.
I do always try new IDEs and whizzy development tools as I become aware of
them -- Eclipse, Screem, etc -- but none have ever seemed to really help
me in any way. I'm sure if I stuck at them, then I might reap some
long-term reward, but I don't really want to invest the time unless I can
get *something*, maybe just a *little* advantage, straight away. They need
to offer me a carrot.

A decent editor with syntax highlighting is my main tool. If I mistype
something, which I am wont to do, then it will be a different colour than
that which I was expecting, so I'll spot it pretty damn quickly. Having a
locally installed server is a godsend too. And I do virtually all my file
management at the command line. Very simple tools that don't get in my
way, and don't do things unless I tell them to do so. And my comparatively
recent (about 2 months ago) discovery of phpDoc is proving very helpful
too. I've always commented my code fairly well, but phpDoc provides me
with a rigorous framework for documenting PHP files, and gives me an
instant reward (the generated, and very readable documentation).

Different working patterns work for different people -- that's the way I've
found works best for me.

As an aside, as I'm mentioning text editors: I use various combinations of
Nedit, SciTE, Nano and TextWrangler depending on which OS I'm using at the
time, and what sort of edit it's likely to be.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 6 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Applebrownbetty | last post by:
Hi, I've run into a problem with IE 6 vs. Mozilla when displaying a completely CSS positioned page, and was wondering if any resident CSS guru might quickly be able to find the problem(s). Thank...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
by: Carlo, MCP | last post by:
Hi, Sorry for posting twice, but I hope in your comprehension. Please help me! I'm troubling from months with a serious serialization problem that I'm not able to solve. I try to describe as...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im...
1
by: oldgent | last post by:
I am having a problem installing the starter kits. I have reinstalled VS 2005, think that might be the problem. I then installed both 'Personal Website" and the "Club Website" starter kits. I...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
2
by: violeta123 | last post by:
I am stuck! Please help It might be difficult to explain the problem via email, but I will try. I have a Win 2003 Enterprise server running with the only purpose of a membership web site...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.