I am generating a string of html using php; however, I have one bit of javascript as part of my code. I don't want to execute the javascript at the point of creating the string but later on in the sheet where the form belongs.
I have cut out the section in question, but you can see the entire bit of code listed further down.
PHP Code:
case 4: //Display calendar $str_new.=; ?> <script> DateInput('ship_date') </script> <?php break;
PHP Code:
if(isset($_GET['n'])){ $tabindex=1; mysql_data_seek($r_variable,0); while ($rw_variable=mysql_fetch_assoc($r_variable)) { switch ($rw_variable['e_format']){ case "U": //Insert update button $str_new='<form action="display_page.php?pg='.$_SESSION['pg'].'" method="post"><tr>'. '<td><input type="submit" value="Update" /></td>'; break; case 1: //Display textbox to allow editing $str_new.='<td><input type="text" maxlength="'.$rw_variable['e_maxlength'].'" size="'.$rw_variable['e_size'].'" name="'.remove_table($rw_variable['field']).'" tabindex="'.$tabindex++.'"></td>'; break; case "d1": //Display dropdown list for available document status $str_new.='<td><select class="text" name="'.remove_table($rw_variable['field']).'"><option selected></option>'; $r_dd=query($rw_variable['dd_sql']); while ($rw_dd=mysql_fetch_assoc($r_dd)) { $str_new.='<option>'.$rw_dd['s'].'</option>'; } $str_new.='</select></td>'; break; case "d2": //Display dropdown list for available project team names $str_new.='<td><select class="text" name="'.remove_table($rw_variable['field']).'"><option selected></option>'; echo $rw_variable['dd_sql'].'<br />'; $r_dd=query($rw_variable['dd_sql']); while ($rw_dd=mysql_fetch_assoc($r_dd)) { $str_new.='<option>'.$rw_dd['name'].'</option>'; } $str_new.='</select></td>'; break; case 3: //Display checkbox $str_new.='<td><input type="checkbox" name="'.remove_table($rw_variable['field']).'" value="1" checked tabindex="'.$tabindex++.'"></td>'; break; case 4: //Display calendar $str_new.='calendar'; /* ?> <script> DateInput('ship_date') </script> <?php break; default: //Null: Displays text only $str_new.='<td></td>';*/ break; } } $str_new.='</tr>'; //Closes new row }
|