Hi dont know if this can be done but i would like to have an auto calcculator for my ferret boarding we charg £2.50 a day so I would like to be able to add the date they arive and it would auto add £2.50 a day![]()
![]()
Hi dont know if this can be done but i would like to have an auto calcculator for my ferret boarding we charg £2.50 a day so I would like to be able to add the date they arive and it would auto add £2.50 a day![]()
![]()
Fairly simple.
Just multiply the number of days times 2.5, then display it.
But we'd need to know the layout of your site to see how it would fit in.
One thing you'll need to decide--
Do you want it to be live on the page as the user enters the info or should this happen after the form has been submitted and page has loaded again?
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Something like that?Code:<form name="calculator" action="?calc" onSubmit="this.cost.value = this.days.value*2.5;return false;"> Number of days: <input name="days" type="text" value="<?php echo $_POST['days']; ?> "><br> Cost: <input type="text" name="cost" disabled value="<?php echo (@$_POST['days']*2.5); ?>"><br> <input type="submit" value="Calculate"> </form>
Note that the PHP code acts as a backup if javascript isn't enabled on the users' computers. However, you must have PHP installed on your server and the page must end with a .php extension. If not, remove those value= attributes entirely, and know that the user must have javascript.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks