Jump to content

[SOLVED] SQL lite form data script


winmastergames

Recommended Posts

Hi i have a script that sends data into a SGL Lite database but the webpage that the users send the data also displays it is it possible to display it on another webpage?

 

heres the script

<?php include("langsettings.php"); ?>
<html>
<head>
	<meta name="author" content="Kai Oswald Seidler">
	<link href="xampp.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

		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><img src="img/blank.gif" alt="" width="10" height="25"></td>
			<td class="tabhead"><img src="img/blank.gif" alt="" width="150" height="6"><br><b><?php echo $TEXT['phonebook-attrib1']; ?>Name</b></td>
			<td class="tabhead"><img src="img/blank.gif" alt="" width="150" height="6"><br><b><?php echo $TEXT['phonebook-attrib2']; ?>Email</b></td>
			<td class="tabhead" style="width: 452px"><img src="img/blank.gif" alt="" width="150" height="6"><br><b><?php echo $TEXT['phonebook-attrib3']; ?>Message</b></td>
			<td class="tabhead"><img src="img/blank.gif" alt="" width="50" height="6"><br><b><?php echo $TEXT['phonebook-attrib4']; ?>Delete?</b></td>
			<td><img src="img/blank.gif" alt="" width="10" height="25"></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 "<tr valign='bottom'>";
					echo "<td bgcolor='#ffffff' height='1' style='background-image:url(img/strichel.gif)' colspan='6'></td>";
					echo "</tr>";
				}
				echo "<tr valign='middle'>";
				echo "<td class='tabval'><img src='img/blank.gif' alt='' width='10' height='20'></td>";
				echo "<td class='tabval'><b>".$row['lastname']."</b></td>";
				echo "<td class='tabval'>".$row['firstname']." </td>";
				echo "<td class='tabval'>".$row['phone']." </td>";

				echo "<td class='tabval'><a onclick=\"return confirm('".$TEXT['phonebook-sure']."');\" href='phonebook.php?action=del&id=".$row['id']."'><span class='red'>[".$TEXT['phonebook-button1']."]</span></a></td>";
				echo "<td class='tabval'></td>";
				echo "</tr>";
				$i++;
			}

			echo "<tr valign='bottom'>";
			echo "<td bgcolor='#fb7922' colspan='6'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
			echo "</tr>";

			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>

 

Its an edited Phonebook script that someone gave me

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.