Jump to content

[SOLVED] Error message with my else statement.


denoteone

Recommended Posts

I am getting an error regarding my second "else' statement. I am trying to do this myself but my brain is hurting from looking at the screen all day pulling my hair outt! ???

 

what am I missing.

 


<? 
echo " 
<html> 
<head> "; 



if(isset($_POST["submit"])) {

    include "connect.php"; 

    $name = $_POST['name'];
    $path = $_POST['path']; 
    $description = $_POST['description']; 
    $date = getdate(); 

    if(strlen($name)<1 || strlen($path)<1 || strlen($description)<1)
      {
        print "<table>";
        print "<tr><td><center>Trying to add file.</center></td></tr>";
        print "<tr><td><center>";
        print "One of the required fields was not filled in, please go back and try again";
        print "</td></tr></table>";
      } 
  else 
  {

    $posting="INSERT INTO strata_links (name, path, description,date) values ('$name', '$path', '$description', '$date')";
     mysql_query($posting) or die("could not post");
} 
else 
{ 
?> 
</head> 
<body bgcolor="white">
<table align="center" border="1" bordercolor="gray" width="400px">

<tr>
<td><form action="<?=$PHP_SELF?>" method="post">
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">name of file</font><input type="text" name="name" value="name of file" /><br/><br/>
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Complete Path of File:</font><input type="text" name="path" value="Complete Path here"/><br/><br/>
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Description of file:</font><textarea id='7' rows='6' name="description" cols='45'></textarea>
<input type="submit" name="submit" value="submit" /></form> 
</td> 
</tr> 
</table>  
</body>  
</html>
<? 
} 
?> 

<?php
echo " 
<html> 
<head> ";


if (isset($_POST["submit"])) {

    include "connect.php";

    $name = $_POST['name'];
    $path = $_POST['path'];
    $description = $_POST['description'];
    $date = getdate();

    if (strlen($name) < 1 || strlen($path) < 1 || strlen($description) < 1) {
        print "<table>";
        print "<tr><td><center>Trying to add file.</center></td></tr>";
        print "<tr><td><center>";
        print "One of the required fields was not filled in, please go back and try again";
        print "</td></tr></table>";
    } else {

        $posting = "INSERT INTO strata_links (name, path, description,date) values ('$name', '$path', '$description', '$date')";
        mysql_query($posting) or die("could not post");
    }
} else {
?> 
</head> 
<body bgcolor="white">
<table align="center" border="1" bordercolor="gray" width="400px">

<tr>
<td><form action="<?= $PHP_SELF ?>" method="post">
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">name of file</font><input type="text" name="name" value="name of file" /><br/><br/>
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Complete Path of File:</font><input type="text" name="path" value="Complete Path here"/><br/><br/>
<font style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF0000;">Description of file:</font><textarea id='7' rows='6' name="description" cols='45'></textarea>
<input type="submit" name="submit" value="submit" /></form> 
</td> 
</tr> 
</table>  
</body>  
</html>
<?
}
?> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.