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

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security 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:
 





Benm

0
Joined
Aug 16, 2007
Messages
7,896
Points
113
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 ;)
 
Joined
Apr 29, 2010
Messages
24
Points
3
i'm struggling to think of problems to solve that only require the things that i've already learned. :)
 

Benm

0
Joined
Aug 16, 2007
Messages
7,896
Points
113
I suppose you could do calculators for all kinds of things, like the proper resistors in laser drivers and such.
 

Rafa

0
Joined
Feb 4, 2010
Messages
437
Points
0
Graphics are no that hard with GD and libs like that.
 
Joined
May 31, 2009
Messages
3,239
Points
63
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!
 
Joined
Apr 29, 2010
Messages
24
Points
3
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. :)
 
Joined
May 31, 2009
Messages
3,239
Points
63
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...
 

Trevor

0
Joined
Jul 17, 2009
Messages
4,386
Points
113
If you want to clear the boxes without reloading the page, you could take a look at Javascript.

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

-Trevor
 
Joined
Apr 29, 2010
Messages
24
Points
3
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. :)
 




Top