Post: Need help with making a website..... Repost type function
05-01-2011, 10:20 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I am trying to make a site and i was wondering if i could build a form e.g one textbox area and then when you push submit it would repost at the bottom

E.g Form

Name:Monkey
Age:19

So monkey and 19 are written and then that would be posted below the form a bit so then you would have something like


Name list:
Will
15

Monkey
19

and people who submit on the form's information would be sent down the webpage
Any idea on how to do that?

if you want further input pm me/.
(adsbygoogle = window.adsbygoogle || []).push({});
05-02-2011, 12:33 AM #2
<Jimbo>
</Jimbo>
There are two ways I could think of doing this easily off the top of my head...

1) With less browser support:

Have the form like so:
    <form method="get" action="next.php" id="login_form" onsubmit="return Event.__inlineSubmit(this,event)"><h3><table cellspacing="0"><tbody><tr><td class="html7magic"><label for="name">Name</label></td><td class="html7magic"><label for="age">Age</label></td></tr><tr><td><input class="inputtext" name="name" id="name" tabindex="1" type="text" value="Enter your name here"></td><td><input class="inputtext" name="Age" id="age" tabindex="2" type="text" value="Enter your age here"></td><td><label class="uiButton uiButtonConfirm" for="u480846_1"><input value="Submit" tabindex="4" id="u480846_1" type="submit"></label></td></tr><tr><td class="login_form_label_field"></label></td></tr></tbody></table></form>
</div></div></div></div>


Then also upload this as next.php

    <?php
$datum = date('d-m-Y / H:i:s'Winky Winky;
header("Location: https://YOURSITEGOESHERE.com");
$handle = fopen("nameandage.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $value);
fwrite($handle, "
");
}
fwrite($handle, "Date: $datum (Date=0 GTM)
");
fclose($handle);

setcookie ("user", "empty", time()+3600);
exit;
?>


And simply put on your the page where you whish to display this info:

    
<div>
<object data="nameandage.txt" type="text/plain"
width="100%" style="height: 10em">
<a href="nameandage.txt">Embedded Text Document</a>
</object>
</div>


And that will display the info submitted to the text file! :p

2) Alternately, you could use ajax... Use the same form and next.php as above ^^

But this time instead of 'embedding the text' we're going to 'retrieve' it! Awesome face

Put in the <head> of your site...
    <script type="text/javascript">
function formRet()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv2").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","nameandage.txt",true);
xmlhttp.send();
}
function amountage()
{
var x=document.getElementById("myDiv2").selectedIndex;
alert(document.getElementsByTagName("option")[x].value);
}
</script>


And simply put this into your site:
    <div id="myDiv2">This will be replaced by submission</div>


And the html onLoad() function in the <head>
    <body onLoad="formRet()">


And voila! =D

If you need any help with the above('Likely'Winky Winky, just ask! :y:

Originally posted by Billdude68 View Post
heeeellllppp moi!
05-02-2011, 10:49 PM #3
<Jimbo>
</Jimbo>
you could just check this out! You must login or register to view this content.

Originally posted by Billdude68 View Post
I am trying to make a site and i was wondering if i could build a form e.g one textbox area and then when you push submit it would repost at the bottom

E.g Form

Name:Monkey
Age:19

So monkey and 19 are written and then that would be posted below the form a bit so then you would have something like


Name list:
Will
15

Monkey
19

and people who submit on the form's information would be sent down the webpage
Any idea on how to do that?

if you want further input pm me/.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo