#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    10
    Rep Power
    0
    I am using web pages to search a LDAP database of employees and display their details, but only the first occurence of an
    attribute.

    I am now wanting to use these pages to be able to change the details.

    I require that all details be on the web page including all occurrences of an attribute.
    for example all users have 2 email addresses.

    I am using a textarea to store these details as I am unable to edit the information if it is output to a select field.

    When I send the data the 2 lines are concatinated
    ie. NOC@cca.czantonin.novak@cca.cz.
    I have tried using "<br>" <p> these only get added to the entry
    ie. NOC@cca.cz<br>antonin.novak@cca.cz.

    If I use wrap I can do it using the exact number of columns, but the length of these entries can differ with every user.

    I have looked for an answer, but can't find how to do it.

    Can you please help me.

    Thanks


    Tony
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    16
    Rep Power
    0
    I am also working on an LDAP project, I'm not sure what you are looking to do using the text area, why can you put this into a normal text field? Post some code so I can see what you are doing, I have just been populating form fields (text) and updating from there on my projects. I don't understand why you are using the textarea for this, give more details if I am not understanding the scenario.

    -Ray
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    10
    Rep Power
    0
    Ray

    It makes a nice change finding someone else using PHP and LDAP.

    As I said earlier, we use LDAP to store staff details. Some of these details use the same attributes.
    eg.

    dn: cn=noc,dc=pokus,dc=cz
    objectclass: person
    cn: NOVAK Antonin Christopher
    PC: PAPI14
    PC: Pokus
    givenName: tony
    ou: STP
    ou: 32
    ou: Systemova a technika podpora
    mail: noc@pokus.cz
    mail: Antonin.Novak@pokus.cz
    etc.

    I have a page which will list the details of this record if any value is specified.
    The form has the same fields as the corresponding attributes above. eg Mail, surname etc.

    This page works fine.

    I am now looking to take this a stage further and create the capabilty to amend the data from the web page.
    eg change ou to PCS, 55 and PC Support.

    If I output the data to a text field I only get the first occurence of the attribute
    eg.
    PC=PAPI14 and not Pokus
    OU=STP and not 32 or Systemova etc

    I coded that the output was in a select field, that has a better appearance than textarea, but you cannot edit a select field.

    This only left me with Textarea.

    If I use the mail example my coding is:
    within PHP
    $mail1=$info[$i]["mail"][0];
    $mail2=$info[$i]["mail"][1];
    $mail=$mail1."<br>".$mail2;
    echo $mail // this displays
    // MAIL = noc@pokus.cz
    antonin.novak@pokus.cz

    in HTML
    <textarea cols="15" name="mail"><?php echo $mail?></textarea>

    This displays in the Mail box on the form
    noc@pokus.cz<br>antonin.novak@pokus.cz

    Thanks for any help you can give

    Tony



  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Your problem lies in this line:

    $mail=$mail1."<br>".$mail2;

    HTML tags are not recognized in the textarea. You need to insert a newline character instead:

    $mail=$mail1."n".$mail2;
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    16
    Rep Power
    0
    I would not use the textarea, too messy. A better choice would be to test for multi-value on that attribute
    and then print the value to a text field for editing. Example:

    if($linkIdentifier = ConnectBindServer($myRDN,$myPass) && $uuid != "") {

    $searchResult=ldap_search($linkIdentifier,$baseDN,"uid=$uuid");

    if ($searchResult) :
    $info = ldap_get_entries($linkIdentifier,$searchResult);
    $mail1 = $info[0]["mail"][0];
    $mail2 = $info[0]["mail"][1];
    $myURL = $info[0]["labeleduri"][0];
    $commonname = $info[0]["cn"][0];
    $ou1 = $info[0]["ou"][0];
    $ou2 = $info[0]["ou"][1];
    $ou3 = $info[0]["ou"][2];

    ?>
    <form action="<?php echo ($PHP_SELF);?>" method=post>
    Common Name: <input type=text name=cn value="<?php echo ($commonname);?>">
    Org Unit 1: <input type=text name=ou1 value="<?php echo ($ou1);?>">
    Org Unit 2: <input type=text name=ou2 value="<?php echo ($ou2);?>">
    Org Unit 3: <input type=text name=ou3 value="<?php echo ($ou3);?>">
    Email 1: <input type=text name=mail value="<?php echo ($mail1);?>">
    Email 2: <input type=text name=mail value="<?php echo ($mail2);?>">
    <input type=submit name=action value="Update Info">
    </form>
    <?php

    else :
    printf("<p>Lookup failed.<p>n");
    endif;
    }else{
    printf("<p>Your credentials could not be authenticated, please try again.<p>");
    echo "<meta http-equiv=refresh content=1;url=$domain/>n";
    }

    Now just do the editing on each attribute and then do the ldap_modify with the newly updated info.

    -Ray

    [This message has been edited by ray_cormier (edited July 28, 2000).]

Similar Threads

  1. inserting multiple email address from a textarea
    By mrkgrav in forum PHP Development
    Replies: 17
    Last Post: September 24th, 2004, 07:28 PM
  2. Variables and multiple lines.
    By eponym in forum HTML Programming
    Replies: 4
    Last Post: February 16th, 2004, 10:32 AM
  3. sending multiple variables to a function
    By myrrdan in forum Visual Basic Programming
    Replies: 2
    Last Post: February 3rd, 2004, 03:07 PM
  4. parse multiple lines
    By sfutch in forum Perl Programming
    Replies: 2
    Last Post: November 18th, 2003, 04:28 PM
  5. Sending emails to multiple recipients?
    By adameve in forum HTML Programming
    Replies: 2
    Last Post: October 15th, 2003, 06:48 AM

IMN logo majestic logo threadwatch logo seochat tools logo