Adding a button within a div onclick event

images php coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Thu Jun 06, 2013 1:14 am

Adding a button within a div onclick event

Postby fakierock » Thu May 22, 2014 7:20 am

Hi all,

I'm about to rip all of my hair out and have researched everything online to see if I can find a way of fixing this issue.

I have a form which takes in user info. The form also has editable fields where the user can change name, email etc. At the moment the user has to click on the entire div in order to edit their details. I am trying to add an edit icon to the top-right of the input field so that once they click on that it will allow them to edit the field.

I have managed to do this for the upload field, but for the life of me I cannot figure out how to do it for name etc.

My code for the upload (which works) is :

Code: Select all

<div class="boxLine_upload">

    <label style="height:50px;">Latest CV:</label>
      <div class="form-control">
      <?=($user->cv)?'<a href="ajax-redirect.php?page=download-file.php&path='.$user->user_server_path.$user->cv.'"&file_name='.$user->cv.' class="current_file" id="cv_'.$user->user_id.'">'.$user->cv.'</a>':''; ?>

      <div onclick="ed_file(this,'<?=addslashes(UPLOAD_PATH.$user->user_server_path)?>','<?=addslashes($user->user_server_path)?>','file')" placeholder='Click to upload' title='Click to upload' style="cursor:pointer;" id="users-cv-<?=$user->user_id?>-userfile"><img src="images/buttons/edit_icon.jpg" style="position:absolute; margin:-16px 0 0 290px;"/></div>

However, the code for the email field (which isn't working) is:

Code: Select all

 <div class="boxLine_lg">
         <label>Email address:</label>
        <div class="form-control"><div onclick="ed(this)"  title='click to edit' style="cursor:pointer;" id="users-email-<?=$user->user_id?>"><?=($user->email)?$user->email:'<img src="images/buttons/edit_icon.jpg" style="position:absolute; margin:-16px 0 0 290px;"/>'; ?></div></div>

It would be very much appreciated if someone could point me in the right direction as I feel I have tried everything.

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest