problem with copy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Davide

    #1

    problem with copy

    Hi all,
    I don't understand why this script want work

    if($_POST['students'] == true)
    copy("$file" , "/students/$file_name")
    else echo "no check";

    Parse error: parse error, unexpected T_ELSE

    really thanx :)

  • Sjoerd

    #2
    Re: problem with copy

    You forgot the semicolon:

    Davide wrote:[color=blue]
    > if($_POST['students'] == true)
    > copy("$file" , "/students/$file_name") <-- put a semicolon here
    > else echo "no check";
    >
    > Parse error: parse error, unexpected T_ELSE[/color]

    Comment

    • Johannes Mueller

      #3
      Re: problem with copy

      Davide schrieb:
      [color=blue]
      > Hi all,
      > I don't understand why this script want work
      >
      > if($_POST['students'] == true)
      > copy("$file" , "/students/$file_name")
      > else echo "no check";
      >
      > Parse error: parse error, unexpected T_ELSE
      >
      > really thanx :)[/color]

      I would change two things - at first i would use braces. And the second
      thing (it's the error) - use the semikolon at the end of a line!

      if([..]){
      [do s.th.];
      } else {
      [do s.th.];
      }

      good luck
      Johannes

      --
      Emails ohne "[nospam]" im Betreff werden kommentarlos gelöscht.

      Comment

      Working...