General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 17th, 2003, 02:38 PM
imati0n imati0n is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 4 imati0n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help...

Here is the code for my dilemna .. My question is below it:

PHP Code:
<?php



//start the session

session_start();



//check to make sure the session variable is registered

if(session_is_registered('username')){



//the session variable is registered, the user is allowed to see anything that follows


$db mysql_connect("localhost""imati0n_sess""sess");

mysql_select_db("imati0n_sess",$db);



if (
$submit) {

  
// here if no ID then adding else we're editing

  
if ($id) {

    
$sql "UPDATE customers SET first='$first',last='$last',email='$email',domain=  '$domain',package='$package',SubscriptionStart='$S  ubscriptionStart',SubscriptionEnd='$SubscriptionEn  d' WHERE id=$id";

  } else {

    
$sql "INSERT INTO customers (first,last,email,domain,package,SubscriptionStart  ,SubscriptionEnd) VALUES ('$first','$last','$email','$domain','$package','$  SubscriptionStart','$SubscriptionEnd')";

  }

  
// run SQL against the DB

  
$result mysql_query($sql);

  echo 
"Record updated/edited!<p>";

} elseif (
$delete) {

    
// delete a record

    
$sql "DELETE FROM customers WHERE id=$id";    

    
$result mysql_query($sql);

    echo 
"$sql Record deleted!<p>";

} else {

  
// this part happens if we don't press submit

  
if (!$id) {

    
// print the list if there is not editing

    
$result mysql_query("SELECT * FROM customers",$db);

    while (
$myrow mysql_fetch_array($result)) {

      
printf("<a href=\"%s?id=%s\">%s %s</a> \n"$PHP_SELF$myrow["id"], $myrow["first"], $myrow["last"]);

      
printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>"$PHP_SELF$myrow["id"]);

    }

  }



  

  echo(
" <P>

  <a href='checkLogin.php'>ADD A RECORD</a>

  <P>

  <form method='POST' action='checkLogin.php'> "
);


  if (
$id) {

    
// editing so select a record

    
$sql "SELECT * FROM customers WHERE id=$id";

    
$result mysql_query($sql);

    
$myrow mysql_fetch_array($result);

    
$id $myrow["id"];

    
$first $myrow["first"];

    
$last $myrow["last"];

    
$email $myrow["email"];

    
$domain $myrow["domain"];
    
    
$package $myrow["package"];
    
    
$SubscriptionStart $myrow["SubscriptionStart"];
    
    
$SubscriptionEnd $myrow["SubscriptionEnd"];


    
// print the id for editing



    
echo('
    <input type=hidden name="id" value="<?php echo $id ?>">
        '
);

    

  }

       echo(
'
  First name:<input type="Text" name="first" value="$first"><br>

  Last name:<input type="Text" name="last" value="$last"><br>

  Email Adress:<input type="Text" name="emailaddress" value="$email"><br>

  Domain Name:<input type="Text" name="domainname" value="$domain"><br>
  
  Package:<input tpe="Text" name="package" value="$package"><br>
  
  Subscription Start:<input tpe="Text" name="SubscriptionStart" value="$SubscriptionStart"><br>
  
  Subscription End:<input tpe="Text" name="SubscriptionEnd" value="$SubscriptionEnd"><br>

  <input type="Submit" name="submit" value="Enter information">

  </form> '
);

    }

}

else{



//the session variable isn't registered, send them back to the login page

header"Location: http://www.liquidfridge.net/admin/index.php" );

}



?>


What happens is that when the form is shown (To add/edit entries) it doesn't show the information previously entered into the form for that specific record. Here is a screen shot

URL

If anyone can help me I would praise you like an adonis...

Best Regards,
Kyle Foxon

Reply With Quote
  #2  
Old June 17th, 2003, 03:24 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Try this:

PHP Code:
echo("
  First name:<input type=\"Text\" name=\"first\" value=\"$first\"><br>

  Last name:<input type=\"Text\" name=\"last\" value=\"$last\"><br>

  Email Adress:<input type=\"Text\" name=\"emailaddress\" value=\"$email\"><br>

  Domain Name:<input type=\"Text\" name=\"domainname\" value=\"$domain\"><br>

  Package:<input tpe=\"Text\" name=\"package\" value=\"$package\"><br>

  Subscription Start:<input tpe=\"Text\" name=\"SubscriptionStart\" value=\"$SubscriptionStart\"><br>

  Subscription End:<input tpe=\"Text\" name=\"SubscriptionEnd\" value=\"$SubscriptionEnd\"><br>

  <input type=\"Submit\" name=\"submit\" value=\"Enter information\">

</form> "
); 
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 17th, 2003, 03:27 PM
imati0n imati0n is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 4 imati0n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
/me praises you

Thanks a lot

Reply With Quote
  #4  
Old June 18th, 2003, 03:47 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
No problem at all.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Help...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT