change inpu type via php

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Thu Sep 13, 2012 6:43 am

change inpu type via php

Postby JazzKatua » Thu Sep 13, 2012 7:01 am

Hi everybody!

I'm starting to learn PHP.
What I'm trying to do now is to have 2 input type textfields, 1 button and another input type 'Result'-textfield in HTML.
When clicking the button, the 'Result'-textfield should update the value with the sum of the 2 numbers I've typed in the first 2 textfields.
How can I achieve this?

Thx in advance!

User avatar
New php-forum User
New php-forum User
Posts: 25
Joined: Fri Sep 14, 2012 12:06 am

Re: change inpu type via php

Postby TomCornar » Sun Sep 16, 2012 10:58 pm

Try with js or jquery to sum up the two text box value to another textbox using onclick event.

<script type="text/javascript">
function sum()
var value1=document.getElementById('textone').value;
var value2=document.getElementById('texttwo').value;
<form method="post" action="">
<input type="text" id="textone">
<input type="text" id="texttwo">
<input type="text" id="textthree">
<input type="submit" onclick="sum();">
Hope this Helps.
Tom Cornar
Trinay Technology Solutions

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 4 guests