Jump to content

warnings???


jimjimalabim

Recommended Posts

ok people sorry but its late, and I'm tired and I can't figure this out maybe I just need a break? I'm getting some warnings here, first here is my code:

<?php
echo"<?xml version=\1.0\"encoding=\UFT-8\"\x3f>";
echo"\n";
?>

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
  xml:lang="en"lang="en">

<head>
  <title>Assignment 7: Making Space, Part 3</title>
  <meta name="author" content="Jim Cozzy"/>
</head>
<body>
<h1> Assignment 7: Making Space, Part 3 </h1>
<?php
  echo "<h2>Today is ".date('l, F d, Y')."</h2>";
?>

<?php
  //calculate the area of an equilateral triangle
  function calcTriangle($cVal) {
    $halfSide = $cVal/2;
    $otherSide = sqrt(($cVal*$cVal) - ($halfSide*$halfSide));
    $areaValue = $otherSide * $halfSide;
    echo "<p>The area of an equilateral triangle whose sides are
    {$cVal} is {$areaValue}.</p>\n";
  }
$yeah = (isset($_POST['vfld']))?$_POST['vfld']:'';
    if (isset($_POST['submit'])) {
  if ($_POST['submit'] == "Clear") {
    $yeah = "";
   } elseif ($_POST['submit'] == "Calculate") {
      if (!eregi(square|circle|triangle, $yeah)) {
        echo "<p>Sorry I forgot to mention the the shape needs to be
                a Square, Circle, or a Triangle.</p>".
            "<p>Please return and try again.</p>";
     exit;
      }
}}


?>
<form method="post" action="makingspace3.php"
  id="form1" name=form1">
  <p>
  Write down a shape and a number and I will compute the area for:
  <input type="text" id="vfld" name="vfld"
  value="<?php echo $yeah; ?>"/>
  </p>
<p>
  After you have done this click calcualte to see results
  </p>
  <p>
  <input type="submit" name="submit" value="Calculate" />
  <input type="submit" name="submit" value="Clear" />
  </p>
  </form>

<div id="footer">
<pre>This page written by: <cite>James Cozzy</cite> ©2011 and beyond</pre>
</div>

</body>

</html>

 

so when I enter something wrong into my form like ggggg I want it to print an error which it does, but it also says what am I missing????

Notice: Use of undefined constant square - assumed 'square' in /studfs1/homepage/CISS-225/makingspace3.php on line 49

 

Notice: Use of undefined constant circle - assumed 'circle' in /studfs1/homepage/CISS-225/makingspace3.php on line 49

 

Notice: Use of undefined constant triangle - assumed 'triangle' in /studfs1/homepage/CISS-225/makingspace3.php on line 49

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.