Web lists-archives.com

Re: [PHP] Calculator beginner issue





On May 8, 2016, at 11:22 AM, Erwin Noever wrote:

Hello guys,

I am sorry to disturb you.

I followed a tutorial and i am a newbe to php but want to learn.

My calculator doesn't work, i dont see what is wrong.
Please can someone explain what the issue is or give me a hint.
Thank you in advance.
Html Code:

<form method="post" action="calc.php">
   <input type="text" name="nummer1" placeholder="nummer1" />
   <label for="kies">kies</label>
   <select name="reken" id="kies">
       <option>selecteer</option>
       <option value ="plus">+</option>
       <option value ="min">-</option>
       <option value ="delen">÷</option>
       <option value ="maal">x</option>
   </select>
   <input type="number" name="nummer2" placeholder="nummer2" />
   <input type="submit" value="calculeer" />

</form>

Depending on the doctype of your html, you may have some html errors.

For versions of html less than 5, I believe you need a name attribute for your form opening tag. Also the "placeholder" attribute would be invalid.

Otherwise what is happening against expectations,  or not happening that
would expect.

If you aren't aware, a debug console will assist you with html problems.

Another issue would arise if the page with the form is different from the
page that processes the form input. The page with php  that does the
calculation would need its own html to display the result.

I hope this is helpful
JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php