Website Problem

mohityadavx

Youngling
Well one of my friend is developing a website he knows decent HTML bit of css, javascript and php (he is learning them he is in his 1st year only). Now the thing is he made a php website created a form in it taking user input.

Suggest a way to accept data in a form and then we want after clicking submit that the page shows text with new values in it. Something like this:-

Code:
Form 1

Name ; __________
Address ; _____________
Class ; ___________


Output is like this and user can just print it.
Code:
                                      Your Info




My name is ___________. I hate pasta.
My address is ____________. Blah Blah.


I studied in class _________ in 2012.


Please tell how can we do so?

Well we finally solved it using echo.

However is there any way possible using javscript instead of php to do so.
 
Last edited:

nims11

BIOS Terminator
here is the code, it should be self-understood
Code:
<head>
<script type="text/javascript">
function foo()
{
var name=document.form1.text1.value;
var address=document.form1.text2.value;
var classx=document.form1.text3.value;
document.write("<center>Your Info</center><br /><br />");
document.write("My Name is "+name+". i Hate Pasta.<br />");
document.write("My Address is "+address+". Blah Blah<br />");
document.write("I studied in Class "+classx+" in 2012<br />");

}
</script>
</head>
<body>
<form name="form1">
Name :  <input type="text" name="text1" value="" /><br />
Address :  <input type="text" name="text2" value="" /><br />
Class :  <input type="text" name="text3" value="" /><br />
<input type="button" value="Submit" onClick="foo();" /><br />
</form>
</body>
 
OP
mohityadavx

mohityadavx

Youngling
here is the code, it should be self-understood
Code:
<head>
<script type="text/javascript">
function foo()
{
var name=document.form1.text1.value;
var address=document.form1.text2.value;
var classx=document.form1.text3.value;
document.write("<center>Your Info</center><br /><br />");
document.write("My Name is "+name+". i Hate Pasta.<br />");
document.write("My Address is "+address+". Blah Blah<br />");
document.write("I studied in Class "+classx+" in 2012<br />");

}
</script>
</head>
<body>
<form name="form1">
Name :  <input type="text" name="text1" value="" /><br />
Address :  <input type="text" name="text2" value="" /><br />
Class :  <input type="text" name="text3" value="" /><br />
<input type="button" value="Submit" onClick="foo();" /><br />
</form>
</body>

Thanx !
 
Top Bottom