Jump to content

Simple PHP/Java Help..


NSBlaney

Recommended Posts

Hi,

I'm trying to build a little program to do with calculating postage. Unfortunately i haven't got a very good idea of how to use PHP, Java, or any other languages - apart from CSS and HTML -_-. If you are interested in helping..please read on!

 

Basically i want to make a program where i can have a drop down menu with different weights (from 100g to 5000g), and when one is chose a box will pop up indicating howmuch the postage will be, not necesserily a calculator, as i said before, but a small program with many variables.

 

I was thinking of maybe adding countries too - so that postage can be worked out by weight and country/continent(UK, Europe, Asia, etc).

 

If anyone could help by forwarding me to a tutorial, or if anyones knows of an already made script that i can edit i would be highly appreciative.

 

Kindest Regards,

 

Niall Blaney

Telescopics Army Surplus

http://www.telescopics.net

Link to comment
https://forums.phpfreaks.com/topic/185810-simple-phpjava-help/
Share on other sites

The simplest way would be to make one using php and AJAX. I don't know of any tutorials off the top of my head that can explain how to do what you want as it's pretty unique, but you could probably get one coded for you relatively cheaply or you can learn some php at http://www.phpvideotutorials.com and ajax at http://www.deathmonkeyz.com/

Link to comment
https://forums.phpfreaks.com/topic/185810-simple-phpjava-help/#findComment-981139
Share on other sites

Might not even have to use ajax for something like this.

 

Is the math that takes place, just simple multiplication?  Each lb costs ___ dollars?

 

If so it could be as easy as (using jquery)

 

<script type="text/javacript">
    $("select").bind("change",function(){
       calculatePostage($(this).val());
}

function calculatePostage(weight){
var cost = 3.23 // Enter your dollar amount here
alert("Cost is $"+weight * cost)
}
</script>

 

Link to comment
https://forums.phpfreaks.com/topic/185810-simple-phpjava-help/#findComment-981147
Share on other sites

something like this?

 

<html>
<head>
<script type="text/javascript">

function calcpop(){

	var value = frmCalc.ComboWeight.value;

	switch (value)
	{
		case '1': 
			alert("Postage is $1.00");
			break;
		case '2':
			alert("Postage is $2.00");
			break;
		case '3':
			alert("Postage is $3.00");
			break;
	}
}

</script>
</head>

<body>
<form name='frmCalc'>
  		<p>
  		<select name='ComboWeight' onChange='calcpop()'>
    		<option value="" SELECTED>Choose One 
    		<option value="1"> 0g - 500g
    		<option value="2"> 500g - 1000g
    		<option value="3"> > 1000g    
  		</select>
  		</p>
</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/185810-simple-phpjava-help/#findComment-981417
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.