Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How would i add a edit feature to my script?

    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



    Code:
    <?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>";
    }
    }
    }
    ?>
    Last edited by bigredkacy; 06-10-2005 at 04:10 AM.

  • #2
    New Coder
    Join Date
    Feb 2005
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any help?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •