...

View Full Version : How would i add a edit feature to my script?



bigredkacy
06-10-2005, 12:41 AM
How can add edit to this so by each field it has a choice to edit
the fields that array into the file
as in name, phone, fax, onroad , offraod





<?php

$username = "integy";
$password = "";

session_start();


if(isset($_POST['submit'])){
if($_POST['username'] == $username){
if($_POST['password'] == $password){
$_SESSION['a'] = "asdf";
echo "You are now logged in Arthur. <br><br>";
}
}
}

if(!isset($_SESSION['a'])){
echo "<html>
<body>
<form action='admin.php' method='post'>
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<input type='submit' value='Submit' name='submit'>
</form>
</body>
</html>";
}

if($_GET['del'] == "y"){
if(!isset($_SESSION['a'])){
exit;
}
mysql_connect("localhost", "rcnitror_kacy", "");
mysql_select_db("rcnitror_zipcode");
$result = mysql_query("DELETE FROM dealers WHERE id='". $_GET['id'] . "'") or die(mysql_error());
if($result){
echo "Success! <a href='admin.php'>Click to return to admin page</a>";
}
}
else{
if(isset($_SESSION['a'])){
mysql_connect("localhost", "rcnitror_kacy", "");
mysql_select_db("rcnitror_zipcode");
$result = mysql_query("SELECT * FROM dealers");
while($array = mysql_fetch_array($result)){
$id = $array['id'] ."<br>";
echo "Zipcode: ". $array['zip'] ."<br>";
echo "Dealer name: ". $array['name'] ."<br>";
echo "Phone number: ". $array['phone'] ."<br>";
echo "Fax number: ". $array['fax'] ."<br>";
echo "Email: ". $array['email'] ."<br>";
echo "Website: ". $array['url'] ."<br>";
echo "Full time hobby shop: ". $array['fulltime'] ."<br>";
echo "Onroad track: ". $array['onroad'] ."<br>";
echo "Offroad track: ". $array['offroad'] ."<br>";
echo "Carry Integy parts: ". $array['carry'] ."<br>";
echo "Special rder Integy parts: ". $array['order'] ."<br>";
echo "<a href='admin.php?del=y&id=$id'>Delete</a><br><br>";
}
}
}
?>

bigredkacy
06-11-2005, 05:23 AM
any help?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum