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>
<? 
} 
?> 

Link to comment
Share on other sites

<?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>
<?
}
?> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.