You are here: problems with self referential sticky forms « PHP « IT news, forums, messages
problems with self referential sticky forms

Posted by Linda H on 07/20/05 04:01

Hi,

I'm trying to code a form that will call itself. The first time it is
called (by a link), it should display the empty form. If it was called by a
submit to itself, it will validate and then process or re-display the form
if it didn't pass validation.

In Programing PHP I found a technique (example 7-4.):

<?
$fahr = $_GET['fahrenheit'];
if (is_null($fahr)){ echo 'fahr is null';}
$>

The text says "we copy the form parameter value into $fahr. If we aren't
given that parameter, $fahr contains NULL.

I thought this could be used to create a value that would then be displayed
in the form field. If the parameter wasn't passed, the form field would be
empty. If the paramenter was passed, the value would be displayed. Like so:

<input name="temp" type="text" value="<?php echo $fahr; ?>" />

But when execute the code above I get an error: Notice: Undefined index:
fahrenheit in C:\Program Files\Apache Group\Apache2\htdocs\.........

Yet, the line 'fahr is null does print', so $fahr was successfully created.
Because I'm in debug mode, my error reporting is set to E_ALL. Are these
sorts of errors ones that will disappear when the error reporting threshold
is set lower. Should they be accepted in a development environment. Or is
there a better way of accomplishing what I want to do.

Thanks,
Linda

 

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

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