[PHP] Empty form

2002-02-15 Thread Ben Clumeck

I am trying to have my form redirect back to my form, if the 'name' field is
not filled in or the submit button is not pushed.  Can someone tell me what
my problem is with the script below that I have in my header:

?
if(!isset($name)||($HTTP_POST_VARS[submit]))
{
header(Location: form.htm);
}
?

Thanks,

Ben


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty form

2002-02-15 Thread hugh danaher

Using header() to return will clear the entire form where all you want is
the person to fill in missing data.  Yes?

I'd use something like:

if(!isset($name) die(Use the Browser's Back Button, fill in your name and
hit the \Submit\ Button);

if(!isset($address) die(Use the Browser's Back Button, fill in your address
and hit the \Submit\ Button);
etc.

This way, the user fills in only the missing data.
Hope this helps.
Hugh

- Original Message -
From: Ben Clumeck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, February 15, 2002 12:24 AM
Subject: [PHP] Empty form


 I am trying to have my form redirect back to my form, if the 'name' field
is
 not filled in or the submit button is not pushed.  Can someone tell me
what
 my problem is with the script below that I have in my header:

 ?
 if(!isset($name)||($HTTP_POST_VARS[submit]))
 {
 header(Location: form.htm);
 }
 ?

 Thanks,

 Ben


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty form

2002-02-15 Thread Steven Walker

Ben,

I've been dealing with this problem recently. The solution I found works 
great in my case... the data processing page is the same as the form 
page.

When the page is loaded it tests for post data. If no data is available 
(ie !isset($name)), then the form will be displayed. When the user 
submits the form, it actually submits it to the same page ($PHP_SELF). 
This way, no matter how many times the user makes mistakes, your page 
will faithfully redisplay the form until they get it right. You can even 
build in special formatting, such as highlighting missing or incorrect 
fields.

When the post data is verified, the page can display the next page by 
using an include() or header() redirect, and bypass the form.

I hope this helps.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]

On Friday, February 15, 2002, at 12:24  AM, Ben Clumeck wrote:

 I am trying to have my form redirect back to my form, if the 'name' 
 field is
 not filled in or the submit button is not pushed.  Can someone tell me 
 what
 my problem is with the script below that I have in my header:

 ?
 if(!isset($name)||($HTTP_POST_VARS[submit]))
 {
 header(Location: form.htm);
 }
 ?

 Thanks,

 Ben


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Empty form variables when uploading, Help please???

2001-11-11 Thread Sandra Rascheli

Hi everybody,

I hope someone is able to help me with this, I've been having this problem for  a 
couple of months now and I have not been able to find a solution. I have a form to 
upload a file which submits to itself, and has two submit buttons, one called 
eliminarfoto (deletephoto) and salvar (savephoto), but for some weird and 
unexplainable reason (it only happens to some users, not all of them) when they hit 
any of these two submit buttons, the form returns empty variables.

This is part of my script, has anybody had a similar problem before??? Any help would 
be greatly appreciated.

 FORM ENCTYPE=multipart/form-data ACTION=foto.php METHOD=POST
 TABLE border=0 cellPadding=2
 TR
  TD VALIGN=TOPPFONT face=Verdana size=1BFoto/B 
  (opcional,brtamaño máximo: 20k,brformatos permitidos: JPEG, GIF)/FONT/TD
  TD
  ? if ($foto) 
  { 
  echo IMG align=bottom border=0 width=140 height=160 src=\../fotos/$foto?nc= . 
time() .\br; 
  }
  ?
  INPUT TYPE=hidden name=MAX_FILE_SIZE value=100
  INPUT NAME=userfile TYPE=file
  INPUT TYPE=submit NAME=eliminarfoto VALUE=Eliminar
  INPUT TYPE=hidden NAME=foto VALUE=? echo $foto ?
  /TD
 /TR
 TR
  TD VALIGN=TOP COLSPAN=2 ALIGN=CENTER
  font face=Verdana,Arial,Helvetica,Sans-serif size=2 
  INPUT TYPE=SUBMIT NAME=salvar VALUE=Continuar -/TD
  
 /TR
 /TABLE
 /FORM




Re: [PHP] empty form field = pgsql NULL gracefully how?

2001-02-15 Thread Richard Lynch

 INSERT INTO testtab2
 VALUES ( upper('$symbol'), '$two_liner', '$href',
  '$full_desc', '$submitter_name',
  '$submitter_email', CURRENT_TIMESTAMP )
 
 I hate to muck them up with a bunch of tests for empty vars, which then
 need to be replaced with NULL and have the single quotes ommited, etc. if
 there is some more graceful way?

$foo = strlen($foo) ? "'$foo'" : 'NULL';
.
.
.
$query = "insert into bar (foo,...) values($foo,...)";

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] empty form field = pgsql NULL gracefully how?

2001-02-13 Thread Britton


Having nice simple things like

INSERT INTO testtab2
VALUES ( upper('$symbol'), '$two_liner', '$href',
 '$full_desc', '$submitter_name',
 '$submitter_email', CURRENT_TIMESTAMP )

I hate to muck them up with a bunch of tests for empty vars, which then
need to be replaced with NULL and have the single quotes ommited, etc. if
there is some more graceful way?

Britton Kerin
__
GNU GPL: "The Source will be with you... always."


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]