SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    0 Post(s)
    0 Thread(s)

    Manipulate webpage images with perl

    I have to create a web phonebook in ajax and perl. When i enter the name Paul or Celine in a text field on my web page and click on a button to submit it, a perl script return an adress, a phone number and the email address that match the entered name.

    I've got 2 problems:
    1) The perl script also has to return an image that match with the name entered in the text field.

    example: If i enter celine in the text field and click on submit, the info about celine will be displayed and her image has well.

    I don't know how to do that...

    If the name entered does not exist in the perl file, an error message has to be displayed on the webpage.

    Here's a part of my perl code:

    $searchname = $query{"firstname"};

    %addressdb = ('Alex' => '105 rue mentanna, vancouver, BC, Canada',
    'Celine' => '95 rue clark toronto, ontario, Canada');

    %phonedb = ('Alex' => '1-888-000-0000',
    'Celine' => '1-888-111-1111');

    %emaildb = ('Alex' => '',
    'Celine' => '');

    Here a part of my ajax code:

    if (http.readyState == 4){

    var response = http.responseText;
    var update = new Array()

    if (response.indexOf('|')) {
    update = response.split('|')
    document.getElementById('address').innerHTML = update[0]
    document.getElementById('phone').innerHTML = update[1]
    document.getElementById('email').innerHTML = update[2]


  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Moon Base Alpha
    0 Post(s)
    0 Thread(s)
    If you wrote the above code then the perl side of your question should be easy. Continuing in the same vane just add another hash that points to the URI of an image file. The javascript code I can't help with.


Posting Permissions

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