SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2011
    Posts
    221
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Saving technique

    Greetings!

    I have here three forms, pages A.php, B.php and C.php

    A.php

    PHP Code:
    foreach ($Acode as $code) {
        echo 
    $code$Titles$Subs ,$Pubs$Pubnames ,$Bnums.'<br/>';
        
    mysql_query("INSERT INTO tbl_bdetail (bdetail_Title, bdetail_Subject, bdetail_Pubname, bdetail_Pubplace, bdetail_Classnum, author_Id)
                     VALUES ('
    $Titles', '$Subs', '$Pubs', '$Pubnames', '$Bnums', '$code')") or die (mysql_error()); 
        }
        
        for(
    $i 0$i count($Acode); $i++) {
        
    $Acod $Acode[$i];
        
    $Fnam $Fname[$i];
        
    $Lnam $Lname[$i];
        
    $Mnam $Mname[$i];
      
        
    $Title $Titles[$i];            
        
    $Sub $Subs[$i];            
        
    $Pub $Pubs[$i];            
        
    $Pubname $Pubnames[$i];            
        
    $Bnum $Bnums[$i];

        echo 
    "$Acod $Fnam $Lnam $Mnam <br/>";
        
    mysql_query("INSERT INTO tbl_author (author_Id, author_Fname, author_Lname, author_Mname)
                      VALUES ('
    $Acod', '$Fnam', '$Lnam', '$Mnam' )") or die (mysql_error());
        } 
    I manage to save the data from A.php, what troubles me is that I'm confused on how to save the data from B.php, which has an array of accnum[], copy[], locate[], funds[], stat[] and remarks[], and a string value of copyright, pages, book amount, and supplier.

    My problem is I don't know how to save it effectively. I need to save the data from B.php which include the id [autoincrement] value of tbl_bdetail.

    To make it clear, I want to save, tbl_bdetail.id , accnum[], copy[], locate[], funds[], stat[], remarks[], copyright, pages, book amount, and supplier in tbl_baccquisition.

    Thank you in advance.

  2. #2
    SitePoint Zealot RyanKing1809's Avatar
    Join Date
    Oct 2011
    Location
    Melbourne, Australia
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having trouble understanding what you're asking, posting more code would be helpful (eg. b.php).

    From what I understand, you have some variables in one file you would like to use in another?

    Would this help?
    Code PHP:
    include("B.php");

    If the variables are used for many pages you could put them all in a separate file and reference them via the code above.


Bookmarks

Posting Permissions

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