0

I would need to add my variable "count" that I have in JS to my div I use PHP to display.

It is easier to show some code...

$workeduq = mysql_query("SELECT * FROM profile_about WHERE userid = '$id' AND (about_type = 'work' OR about_type = 'education')") or die(mysql_error());
$workeduc = mysql_num_rows($workeduq);
if ($workeduc >= 1) {
while($workedu = mysql_fetch_array($workeduq)) {
    echo '
        <div id="form-+count+" class="workedu_forms">
        <div class="workedu_linkright"><a href="javascript:void(0);"><div class="workedu_right" id="workedu_right_+count+" onclick="workEduShow(+count+);"></div></a></div>
        <input type="text" name="workedu" value="'.$workedu['content_1'].'" /> 
        <ul class="workedu_buttons">
        <!--<a href="#"><li class="workedu_minus"></li></a>-->
        <a href="javascript:void(0);"><li class="workedu_plus" onclick="addRow(0);"></li></a>
        </ul>
        <div class="global_hide" id="workedu_hide_0">
        <input type="text" name="title" value="'.$workedu['content_2'].'" /><br />
        <div id="workedu_fromto_+count+" style="height:50px;width:250px">';
        </div>
        </div>
        </div>
    ';
}
}

Where it says "+count+", that is where I need to add the JS-variable. I have done this in JS as well but this part I have to do in PHP, any clues?

TheMeisterSE
  • 541
  • 1
  • 7
  • 28
  • what is that count use for and what should be the value? – Paul Lo Nov 24 '13 at 17:23
  • 1
    Remove all your inline JavaScript, because it’s the stuff of nightmares. Remove `id="form-+count+"`, `id="workedu_fromto_+count+`, and every other `id`. Select forms by the class `workedu_forms` in your JavaScript and pass each one to a function that adds the appropriate handlers. – rninty Nov 24 '13 at 17:23

0 Answers0