drewpear Posted February 8, 2017 Share Posted February 8, 2017 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 Quote Link to comment https://forums.phpfreaks.com/topic/303133-calculate-expression-from-user-input/ Share on other sites More sharing options...
Jacques1 Posted February 8, 2017 Share Posted February 8, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303133-calculate-expression-from-user-input/#findComment-1542456 Share on other sites More sharing options...
drewpear Posted February 9, 2017 Author Share Posted February 9, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303133-calculate-expression-from-user-input/#findComment-1542489 Share on other sites More sharing options...
Jacques1 Posted February 9, 2017 Share Posted February 9, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303133-calculate-expression-from-user-input/#findComment-1542491 Share on other sites More sharing options...
drewpear Posted February 10, 2017 Author Share Posted February 10, 2017 (edited) 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 February 10, 2017 by drewpear Quote Link to comment https://forums.phpfreaks.com/topic/303133-calculate-expression-from-user-input/#findComment-1542580 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.