Jump to content

Calculate Expression from User Input


drewpear

Recommended Posts

howdy,

 

i've put together a couple calculators to determine the diameter of a spherical resonator for a given frequency.

 

they can be found at http://glassmarimba.com/method/resonators/sphere/calculator/calculator.php

 

they work well enough using a simple expression calculator.

 

it would be better if instead of having to copy the expression and input your variables, one could

 

input the variables into a form field and that would populate the expression to be solved with a click.

 

i don't mind spending some time on this, but my coding skills are limited, especially with php.

 

uh, limited would be generous...

 

if someone could point me in the right direction, it would be appreciated.

 

thank you

Link to comment
Share on other sites

Your request doesn't make much sense to me. You already have multiple forms which do exactly what you claim to not understand. For example, your Frequency Calculator takes two parameters and caculates the result. You can literally copy-and-paste the code, adjust the equation and field names and be done with it.

 

What also confuses me is that you keep talking about PHP, but your calculators are pure JavaScript. PHP is completely irrelevant for the task.

Link to comment
Share on other sites

Your request doesn't make much sense to me. You already have multiple forms which do exactly what you claim to not understand. For example, your Frequency Calculator takes two parameters and caculates the result. You can literally copy-and-paste the code, adjust the equation and field names and be done with it.

 

What also confuses me is that you keep talking about PHP, but your calculators are pure JavaScript. PHP is completely irrelevant for the task.

thank you for your reply. i see i'm in the wrong forum.

 

the calculators i included were cut and paste. i looked at the code, but i'm not seeing what you are saying.

the frequency calculator uses a select box and a form field as the two parameters and one of the two <inputs> is the output.

i can dig it, but it's not clicking how i'm close to a cut and paste correction.

 

since javascript runs the calculators, my mind says they are coded to be specific for the task.

 

thanks for the help. i'll find a javascript forum.

Link to comment
Share on other sites

This is the JavaScript section. Your thread has already been moved.

 

If your code is copied and pasted from somebody else and you neither understand it nor know enough about JavaScript to write your own code, that's a problem. So what do you know? Where can we start?

 

In any case, I strongly recommend against copypasta. Sure, it yields quick results at first. But then you hit the brick wall and are unable to do anything.

Link to comment
Share on other sites

guru, you rock and you make me laugh, in a good way.

thank you for your interest.

i did not know i had been relocated...

 

if you look at the website that the calculator is attached to, built from scratch

with bits and pieces and hosted on my vps.  i do try to know what i am doing, but only to a point.

 

it's mostly to accomplish what i am trying to do at the time and as time goes by, some of it sinks in.

 

i only have the time and ability to learn so much about javascript. i would like to know it though, but i have a lot

on my plate personally, farm wise and web wise. there is a lot offered on the web for so many tasks.

 

my web site is centered around a guide on how to make glass marimbas. unique on the web

and a gift. to me and everyone else. the spherical calculator is unique on the web also. (at least according to google)

 

i would like to make it a little more user friendly.

 

regarding javascript, my knowledge is superficial. i can't open up notepad and create it. i couldn't expalin what a function is or how to use it.

i can work with variables if adding or modifying is pretty straight forward. i can often see how elements within the page are referenced and controlled

by the javascript and edit it if needs be.

 

i tried memorizing jquery, but couldn't do it. (just kidding)

 

as thanks for your interest, if needs be (doubtful), you can head over to my new tutorial on hls streaming from a home web server

which entails some very cool javascript that requires some editing by the user. (one line...lol).

 

http://hls-tutorial.tk/

Edited by drewpear
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.