DIGIT-ARC read-only archive · snapshot: July 23, 2026

Website Problem

3 posts · originally from https://geek.digit.in/community/threads/website-problem.151680/

mohityadavx
mohityadavx Original post #1
Jan 22, 2012 at 11:38 PM
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.
nims11
nims11 #2
Jan 23, 2012 at 1:55 AM
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>
mohityadavx
Jan 23, 2012 at 4:05 PM
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 !