Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php & Javascript in sting
Old 11-19-2010, 03:58 PM php & Javascript in sting
Extreme Talker

Posts: 173
Trades: 0
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
}
dgkindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-19-2010, 04:48 PM Re: php & Javascript in sting
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Create as a function then call it when required
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to php & Javascript in sting
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10294 seconds with 12 queries