Jump to content

[SOLVED] Basic form doesn't work.


bskauge

Recommended Posts

This was working some time ago about, but suddenly, without any changes, it didn't work anymore. This should be pretty basic, but I have no idea why this isn't working.

 

I have a form that asks for three numbers, and based on these numbers there will be a mathematical operation, and the answer will be given on the same page when you hit "beregn!" ("calculate" in english). The problem is that the answer doesn't show up, can anyone help me find out why? My host is running php version 5.2.0, this may have been upgraded, can't remember the last version.

 

The page is located here:

http://www.onlymalts.com/v2/tools/kalkistest.php

 

And this is some of the code:

 

<?php

$alc2 = 1.00;

?>

 

<div id="Layer1" style="position:absolute; left:210px; top:306px; width:472px; height:160px; z-index:7;">

  <span class="tekst">

  <form id="form2" name="form2" method="post" action="">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

      <td width="25%">Antall cl: </td>

      <td width="75%"><input name="cl" type="text" size="4" /></td>

    </tr>

    <tr>

      <td>Alkoholnivå i %:</td>

      <td><input name="alc" type="text" size="4" /></td>

    </tr>

    <tr>

      <td>Ønsket styrke i %:</td>

      <td><input name="styrke" type="text" size="4" /></td>

    </tr>

  </table>

  <br />

  <input type="image" src="/v2/bilder/beregn.jpg" />

  </form>

 

<?php

if ($cl == NULL)

echo ' ';

elseif ($styrke == 0)

echo 'Vann finner du i springen!';

elseif ($alc==0)

echo 'Vi skulle gjerne hjulpet deg med å gjøre vann om til whisky, vi jobber med saken. I mellomtiden anbefaler vi å ta turen innom polet.';

elseif ($cl==0)

echo 'Har du ikke whisky? Ikke en eneste dråpe?!';

elseif ($styrke>$alc)

echo 'Du må tilsette sterkere whisky for å få mer alkohol. Dette er en vannkalkulator!';

elseif ($alc>96)

echo 'Det er vel lite sannsynlig at du har fått tak i noe som er sterkere enn 96%.';

elseif ($styrke>0) {

$alc2 = &$styrke;

$resultat = $cl*($alc/$alc2)-$cl;

echo 'Du må tilsette ' .number_format($resultat,1).' cl vann i '.$cl.' cl med '.$alc.'% whisky for å få '.$alc2.'%.';

}

 

?>

</span>

<br /><br /><? include("../disclaimer.php") ?>

</div>

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.