Jump to content

[SOLVED] Posting form data and also allow to download form data


winmastergames

Recommended Posts

Hi i have a client that whats to post form data to a database but he also wants users of the script to download it aswell how will i got about doing this i thought about it that i could make it save it into a txt file then echo the download link is there any ideas? because to post it to a txt file it would be posting 2 places is there a way to do this? please help me need a fast response please

 

Here is the script i have now

 

<?php include("langsettings.php"); ?>
<html>
<head>
	<meta name="author" content="winmastergames">
	<link href="css.css" rel="stylesheet" type="text/css">
	<title></title>
	<style type="text/css">
.style1 {
margin-bottom: 29px;
}
</style>
</head>

<body>
	 <p>

	<h1><?=$TEXT['phonebook-head']?></h1>

	<?=$TEXT['phonebook-text1']?><p>
	<?=$TEXT['phonebook-text2']?><p>

	<?php
		// Winmastergames.com script
		//
		// This program is free software; you can redistribute it and/or modify
		// it under the terms of the GNU General Public License as published by
		// the Free Software Foundation; either version 2 of the License, or
		// (at your option) any later version.
		//
		// This program is distributed in the hope that it will be useful,
		// but WITHOUT ANY WARRANTY; without even the implied warranty of
		// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		// GNU General Public License for more details.
		//
		// You should have received a copy of the GNU General Public License
		// along with this program; if not, write to the Free Software
		// Thanks...

		if (!($db = sqlite_open('sqlite/phonebook', '0666'))) {
			echo "<h2>".$TEXT['phonebook-error']."</h2>";
			die;
		}
	?>

	<h2><?php echo $TEXT['phonebook-head1']; ?></h2>

	<table border="0" cellpadding="0" cellspacing="0">
		<tr bgcolor="#f87820">
			<td></td>
		</tr>

		<?php
			$firstname=$_REQUEST['firstname'];
			$lastname=$_REQUEST['lastname'];
			$phone=$_REQUEST['phone'];

			if($firstname!="")
			{
					sqlite_query($db,"INSERT INTO users (firstname,lastname,phone) VALUES('$firstname','$lastname','$phone')");
			}

			if($_REQUEST['action']=="del")
			{
					sqlite_query($db,"DELETE FROM users WHERE id={$_REQUEST['id']};");
			}

			$result=sqlite_query($db,"SELECT id,firstname,lastname,phone FROM users ORDER BY lastname;");

			$i = 0;
			while ($row = sqlite_fetch_array($result)) {
				if ($i > 0) {
					echo "";
					echo "";
					echo "";
				}
				echo "";
				echo "";
				echo "";
				echo "";
				echo "";

				echo "";
				echo "";
				echo "";
				$i++;
			}

			echo "";
			echo "";
			echo "";

			sqlite_close($db);
		?>

	</table>

<h2><?=$TEXT['phonebook-head2']?></h2>

<form action=phonebook.php method=get>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td><?=$TEXT['phonebook-attrib1']?>Name</td><td><input type=text size=20 name=lastname></td></tr>
<tr><td><?=$TEXT['phonebook-attrib2']?>Email</td><td> <input type=text size=20 name=firstname></td></tr>
<tr><td><?=$TEXT['phonebook-attrib3']?>Message</td><td> 
<input type=text size=250 name=phone class="style1" style="width: 444px; height: 153px"></td></tr>
<tr><td></td><td><input type=submit border=0 value="Submit<?=$TEXT['phonebook-button2']?>"></td></tr>
</table>
</form>
    <?php include("showcode.php"); ?>
</body>
</html>

 

Note there is another script that views this data that i am not going to post because this is not needed

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.