Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

Buy Site Supporter Role (remove some ads) | LPF Donations

Links below open in new window

FrozenGate by Avery

Learning PHP - first app Laser divergence calculator

Joined
Apr 29, 2010
Messages
24
Points
3
I decided yesterday afternoon to learn PHP

if anyone has ever learned a language on of the hardest things is to think if programs to test what you've learned so far.

having just bought a laser i thought i'd try a quick laser pointer divergence calculator.

Laser Divergence Calculator

what you think?

if there is anything you think it should do then it might help me learn more PHP, i've only been learning for and hour and a half so be gentle :yabbem:
 





Looks fine to me. Starting out with simple little applications like this one is a good way to learn php, although you'll probably want to go towards using databases soon enough ;)
 
i'm struggling to think of problems to solve that only require the things that i've already learned. :)
 
I suppose you could do calculators for all kinds of things, like the proper resistors in laser drivers and such.
 
Looks good.... only thing was the clear button... does that refresh the page? From my tests all I can see is refreshing the page. Wouldn't it be better if it was to only clear the form not refresh the browser? I think that would be an issue in a much larger program.

Just food for thought.... but over all great job!
 
Looks good.... only thing was the clear button... does that refresh the page? From my tests all I can see is refreshing the page. Wouldn't it be better if it was to only clear the form not refresh the browser? I think that would be an issue in a much larger program.

Just food for thought.... but over all great job!

yeah that is sort of what it does yes. the effect of the clear button is to post the form, to itself and then it renders as if it were the first time.

there may well be a much easier way of clearing a form, just nobody told me what it is. :)
 
Can't you just clear input field? I know in c++ there's a function called system("clrscr") and that clears the screen... there has to be one for clearing the input values...
 
If you want to clear the boxes without reloading the page, you could take a look at Javascript.

Code:
document.getElementById('id').value = "";

-Trevor
 
the form is just a regular HTML form that posts to the page itself. php then checks if the calculate button is set and displays the form with the values and does the calculation, if it hasn't, or the clear button is set then it just displays the form empty.

i will come back to it if i learn anything i think i can use. :)
 





Back
Top