SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 42 of 42
  1. #26
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am trying your code,
    i will let you know

  2. #27
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually in your code
    PHP Code:
    header("Location:update.php"); 
    has not any call,means it wont get run until and unless you call something like this
    PHP Code:
    if($_POST['Submit'] == "Get Details" )
                {

                  
    header("Location:update.php");
               } 
    as per my knowledge, what you say?

  3. #28
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah you are right after clicking on "Get Details"
    first get the data of product ,store the values in session and then
    redirect to a update.php.
    Barbara

  4. #29
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but how? i think its bit complicated na?

  5. #30
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it is not complicated i think.
    In your select.php first remove the action attribute of form tag
    or set like
    <form name="form1" action="" method="post">....

    like that.
    Barbara

  6. #31
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried it on my machine and i am getting the product values.
    then i posted my code after checking.
    Barbara

  7. #32
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please dont consider join query and all.
    i just want to pass my values on the next page,
    so, please work on single table product(prod_id,brandname,no_of_qt,notes).
    PHP Code:
    "SELECT * FROM product where prod_id='".$prod_id."'"

  8. #33
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still no problem just change the query in my code and test it.I have tested i am getting the session values on update.php
    change the query
    PHP Code:
    $query "SELECT * FROM product join brand on product.brand_id=brand.brand_id and prod_id='".$prod_id."'"
    to
    PHP Code:
    $query "SELECT * FROM product where prod_id='".$prod_id."'"
    and comment the line
    PHP Code:
    $_SESSION['brandname']=$line['$brandname']; 
    and let me know
    Barbara

  9. #34
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    i am not getting values,bit confused. may be i am newer, so couldn't make out whats wrong.could you please send me your both code. please do it for me . because its really frustrating.
    please help

  10. #35
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my select.php

    PHP Code:
    session_start();
    ob_start();
    $link mysql_connect('localhost''root''')
    or die(
    'Could not connect: ' mysql_error());
    echo 
    'Connected successfully';
    mysql_select_db('testdb',$link) or die('Could not select database');
    echo 
    "connectivity is done";
    if(
    $_SERVER['REQUEST_METHOD'] == "GET")
    {
    $prod_id "";
    $no_of_qt "";
    $notes "";
    $brandname ="";
    }
    else if(
    $_POST['Submit'] == "Get Details" )
    {
        
    $prod_id $_POST['prod_id'];    
        
        
    $query "SELECT * FROM product where prod_id='".$prod_id."'";
        
    // echo $prod_no;
        
    $result mysql_query($query) or die('Query failed: ' mysql_error());    
        
    $line mysql_fetch_array($resultMYSQL_ASSOC);    
        
    $_SESSION['prod_id']=$line['prod_id'];
        
    $_SESSION['no_of_qt']=$line['no_of_qt'];    
        
    $_SESSION['notes']=$line['notes'];
        
    //$_SESSION['brandname']=$line['$brandname'];
        
    header("Location:update.php");
    }

    if(
    $_POST['Submit']=="Back")
    {
        
    header("location3.php");

    Code HTML4Strict:
    <html>
    <head>
    <body>
    <form action="" method="POST" name="productFrm">
    <table>
    	<tr>
    		<td>prod_id</td>
    		<td>
    			<input type="text" name="prod_id" value="" />
    			<label class="errorText"><?php echo $prod_idErr;?></label>
    		</td>
    	</tr>
    	<tr>
    		<td colspan=1>
    		<input type="submit" name="Submit" value="Get Details"/>
    		<input type="submit" name="Submit" value="Back"/>
    		</td>
    	</tr>
    </table> <br>
    </form>
    </body>
    <html>

    and my update.php

    PHP Code:
    session_start();
    ob_start();
    print_r($_SESSION); 

    just put it as it is and let me know.
    Barbara

  11. #36
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    hip hip hurre..
    its working...
    lastly i want these values now in table format. what i need to use than print_r
    or like something following.
    PHP Code:
    if($_SERVER['REQUEST_METHOD'] == "GET"){
                                      
                                 echo 
    $_SESSION['prod_id']; 
                               echo 
    $_SESSION['brandname'];
                               echo   
    $_SESSION['qt_of_no'];  
                               echo   
    $_SESSION['notes']; 
                             
         
          } 
    and for showing in html
    HTML Code:
    <html>
    <head>
    <body>
    <form action="form1" method="post" name="productFrm">
    <table>
    
    <tr><td>prod_id:</td>
    <td>
    <input type="text" name="prod_id" value="<?=$_SESSION['prod_id'];?>" readonly/><label class="errorText"><?=$prod_idErr;?></label></td></tr>
    <tr><td>brandname:</td><td> <SELECT NAME="brandname" value="<?=$_SESSION['brandname'];?>" readonly/><label class="errorText"><?=$brand_idErr;?></label>
        <OPTION VALUE="select">SELECT</option>
        <OPTION VALUE=Lee>Lee</option>
        <OPTION VALUE=Denim>Denim</option>
        <option value=pepe>pepe</option>
        <option value=spyker>spyker</option>
        
        </SELECT></td></tr>
    </tr>
    <tr><td>no_of_qt:</td>
    <td>
    <input type="text" name="no_of_qt" value="<?=$_SESSION['no_of_qt'];?>" /><label class="errorText"><?=$no_of_qtErr;?></label></td></tr>
    <tr><td>notes:</td>
    <td>
    <input type="text" name="notes" value="<?=$_SESSION['notes'];?>" /><label class="errorText"><?=$notesErr;?></label></td></tr>
    <tr><td colspan=4><input type="submit" name="submit" onClick="javascript:return validatepersonal(blogFrm);" value="Update"/><input type="submit" name="Submit" onClick="javascript:return validatepersonal(blogFrm);" value="Back"/></td></tr>
    </table> <br>
    </form>
    </body>

  12. #37
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes barbara, got it.
    thanks a lot...
    you are very smart and clever.
    once again thanks a lot...

  13. #38
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think your html code is ok and it will show up the details of product in your respective textboxes except the brandname.
    But i am afraid while updating the values.
    any way will check.

    Have you checked your html code to see all the details in text boxes?
    Barbara

  14. #39
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs down

    yah, not getting brandname, why so?
    and when i try to update all the values are getting updated with new one.
    but how come? because i am looking for only a perticular prod_id right na. then what is a problem?

  15. #40
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok.first tell me are you getting the value for brandname in your session
    PHP Code:
    echo $_SESSION['brandname']; 
    if yes then you have to make changes in
    Code HTML4Strict:
    <SELECT NAME="brandname" value="<?=$_SESSION['brandname'];?>
    first let me know your session value for brandname.

    And also
    you should populate the data in <select ....> from your database table.right?
    Barbara

  16. #41
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i have written echo statement for brandname.
    and my html cod is
    HTML Code:
    <tr><td>brandname:</td><td> <SELECT NAME="brandname" value="<?=$_SESSION['brandname'];?>" readonly/><label class="errorText"><?=$brand_idErr;?></label>
        <OPTION VALUE="select">SELECT</option>
        <OPTION VALUE=Lee>Lee</option>
        <OPTION VALUE=Denim>Denim</option>
        <option value=pepe>pepe</option>
        <option value=spyker>spyker</option>
        
        </SELECT></td></tr>
    </tr>
    do i need to write here options because, brandname is readonly value.
    (Ex- brandname -lee, and prod_id is'L30", than i ll never change it with the other brands. get my point ?)

  17. #42
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that means you don't want to update the brandname for your product then
    insted of displaying in dropdown display it in a text box and make the textbox readonly.
    Barbara


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
  •