PDA

View Full Version : How would i do this?



Oni
16-02-2007, 06:04 PM
Right i want is so there are 2 boxes right above eachother where people type in their site name and its url. They then press submit and it enters it into a .txt file in this format
text1 = "entered name";
link1 = "entered url";
but then the next person who enters their site in it will add it but like
text2 = "entered name";
link2 = "entered url";
So eventually it would be like
text1 = "entered name";
link1 = "entered url";
text2 = "entered name";
link2 = "entered url";
text3 = "entered name";
link3 = "entered url";
text4 = "entered name";
link4 = "entered url";
What would the code of this be in php or whatever?
[incase your wondering its for a flash]

nets
16-02-2007, 06:15 PM
<?php
if(isset($_POST['text1'], $_POST['link1'])){
$handle = fopen('list.txt', 'a+');
fwrite($handle, "text1 = \"$_POST['text1']\" \n link1 = \"$_POST['link1']\"\n\n");
}
?>
<form method="post">
<input type="text" name="text1" />
<input type="text" name="link1" />
<input type="submit" />
</form>

if you decide to use a different file type other than text (e.g. html), ask for something more secure.

Oni
16-02-2007, 06:42 PM
Thanks nets +rep

Want to hide these adverts? Register an account for free!