Hi,
as to your new error message:
If goes:
if (condition) statement;
so add the round braces around the condition and PHP
will be happy.
In my reply I referred to vars coming from POST action
as $_POST['var_name_here']. This is an implication of
register_globals = off which in turn is a good idea as a
security precaution. "On" is for backward compatibility.

So
...
If (!IsSet($_POST['title'])) {
  // relay the user to the form page. This page
  // was not requested from there!
  header('location: url_of_your_form_page');
}
else {
  $title = $_POST['title'];
  if (trim($title) == '') {
    // handle error: title is mandatory
  }
  else {
    // do whatever is needed with title
  }
}
...
might do the job.
--
Sven


> -----Ursprüngliche Nachricht-----
> Von:  jh [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Mittwoch, 9. Juli 2003 10:03
> An:   [EMAIL PROTECTED]
> Betreff:      [PHP-WIN] Re: Forms-PHP-and-errors
>
> Hi,
>      Thanks for reply.
>       I have wrapped your code in <?php    ?> like so:-
> <?php
> if !isset($title) {
>   // Title contains no valid data
>   $title = ""
> }
>
> if !isset($firstname) {
>   // Title contains no valid data
>   $firstname = ""
> }
>
> if !isset($lastname) {
>   // Title contains no valid data
>   $lastname = ""
> }
> >
> ?>
>
> called it p-6-2.php and this is the error I get:-
> Parse error: parse error, unexpected '!', expecting '(' in 
D:\web\myforms\p-6-2.php on line 4
>
> I have used my own form which uses javascript to validate the fname and 
surname fields, but it still outputs the same error messages!
> ------------------------------------------------------------------------
> Notice: Undefined variable: title in D:\web\myforms\p-6-2.php on line 11
>
> Title is required.
> Notice: Undefined variable: fname in D:\web\myforms\p-6-2.php on line 17
>
> First name is required.
> Notice: Undefined variable: surname in D:\web\myforms\p-6-2.php on line 
23
>
> Last name is required.
>
> Please use your browser's back button to return to the form, correct the 
errors, and re-submit the form.
>
> -----------------------------------------------------
> If I send the output of my form to phpinfo() , I get all my form fields 
listed in ' PHP Variables ' in ' get ' and ' post ' and the data entered 
into my form is there also.
> In php.ini, globles is set off, like so:- register_globals=Off
> Like I say, I am new to php, so I haven't a clue what to do!
>
> Thanks
> jh
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to