HTML form submission, adding info to a list on the page
I am writing an intranet site in HTML, and what online users to be able to
add in their own infomation (such as skype name) so that I dont have to go
through and add it all myself for the 1000 people at the company, and also
so that when new starters come in, they can add their own infomation
themselves.
I currently have a 'Users' page with a link in it to another page where
there is a form code in it looking like this:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>Please type in a message
<input type="text" name="msg" id="msg" />
</label>
<label>and your name
<input type="text" name="name" id="name" />
</label>
<p>
<label>Submit
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>
</form>
<?php
$msg = $_POST["msg"];
$name = $_POST["name"];
$posts = file_get_contents("users.html");
$posts = "$msg - $name\n" . $posts;
file_put_contents("users.html", $posts);
echo $posts;
?>
I want the infomation users put into this form to be automatically put
onto a list on the 'users.html' page, visible to everyone. I had hoped the
above code would achieve this, but I cant get it to work. Also, how would
I specify whereabouts in the 'users.html' page the infomation is put? I
want it to be amongst the:
<div id="content">
<div class="content_item">
..coding, so that it loads into a list inside the webpage.
Many Thanks in advance :)
No comments:
Post a Comment