php-windows Digest 12 May 2007 19:17:01 -0000 Issue 3226

Topics (messages 27873 through 27883):

Re: PHP and JavaScript
        27873 by: Niel Archer
        27875 by: sam rumaizan
        27876 by: sam rumaizan
        27877 by: sam rumaizan
        27878 by: Niel Archer
        27879 by: Niel Archer
        27881 by: Stut

*****SPAM***** Re: [PHP-WIN] PHP and JavaScript
        27874 by: Niel Archer

[EMAIL PROTECTED]
        27880 by: sam rumaizan
        27882 by: Niel Archer

formating a string
        27883 by: James Savage

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi

> Can some one explain to me why this code (Sliding menus) works fine with HTML 
> but it doesn’t work with PHP?

Please define 'doesn't work', as it does exactly the same for me whether
PHP or HTML.

BTW hopefully a typo, but your example has no <HEAD> tag only the
closing one.

I also wouldn't spread a string over several lines like that without
using "here document" syntax, as I'm not sure echo supports it.


Niel

--- End Message ---
--- Begin Message ---
In PHP when you click on the menu text Update The Record the menu doesn’t open 
it takes you to another page. But in HTML when you click on the menu text 
Update The Record the menu dose open.
   
   
  <A HREF='page1.html' onClick='return toggleMenu('menu1')'>Update The 
Record</A>
</H3>
  
Niel Archer <[EMAIL PROTECTED]> wrote:
  Hi

> Can some one explain to me why this code (Sliding menus) works fine with HTML 
> but it doesn’t work with PHP?

Please define 'doesn't work', as it does exactly the same for me whether
PHP or HTML.

BTW hopefully a typo, but your example has no tag only the
closing one.

I also wouldn't spread a string over several lines like that without
using "here document" syntax, as I'm not sure echo supports it.


Niel

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





 

 
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.

--- End Message ---
--- Begin Message ---
In PHP when you click on the menu text Update The Record the menu doesn’t open 
it takes you to another page. But in HTML when you click on the menu text 
Update The Record the menu dose open.
   
   
  <A HREF='page1.html' onClick='return toggleMenu('menu1')'>Update The 
Record</A>
</H3>
  
Niel Archer <[EMAIL PROTECTED]> wrote:
  Hi

> Can some one explain to me why this code (Sliding menus) works fine with HTML 
> but it doesn’t work with PHP?

Please define 'doesn't work', as it does exactly the same for me whether
PHP or HTML.

BTW hopefully a typo, but your example has no tag only the
closing one.

I also wouldn't spread a string over several lines like that without
using "here document" syntax, as I'm not sure echo supports it.


Niel

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





 

 
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.

--- End Message ---
--- Begin Message ---
It works with HTML without body
   
  Copy any paste this code and see it your self.
  So the problem is not the body
   <----------------Start Code------------------------->
  
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE=JAVASCRIPT>
  <!-- Hide script from older browsers
    function toggleMenu(currMenu) {
   if (document.all) {
    thisMenu = eval("document.all." + currMenu + ".style")
    if (thisMenu.display == "block") {
     thisMenu.display = "none"
    }
    else {
     thisMenu.display = "block"
    }
    return false
   }
   else {
    return true
   }
  }
    // End hiding script -->
 </SCRIPT>
 <STYLE TYPE="TEXT/CSS">
  #menu1 {display:none; margin-left:20px}
   </STYLE>
  <H3>
 <A HREF='page1.html' onClick='return toggleMenu("menu1")'>Update The Record</A>
</H3>
<SPAN ID='menu1'>
 <FORM>
    <P>
    <TEXTAREA name='hetext' rows='10' cols='40'>
      Update the record
    </TEXTAREA>
    <INPUT type='submit' value='Update'><INPUT type='reset'>
    </P>
 </FORM>
  
</SPAN>

   <----------------End Code------------------------->

bedul <[EMAIL PROTECTED]> wrote:
  
----- Original Message -----
From: "sam rumaizan" 
To: 

Sent: Saturday, May 12, 2007 1:10 PM
Subject: [PHP-WIN] PHP and JavaScript


> Can some one explain to me why this code (Sliding menus) works fine with
HTML but it doesn't work with PHP?
>
try this.. i just add 
echo "  
      function toggleMenu(currMenu) {
   if (document.all) {
    thisMenu = eval('document.all.' + currMenu + '.style')
    if (thisMenu.display == 'lock') {
     thisMenu.display = 'none'
    }
    else {
     thisMenu.display = 'block'
    }
    return false
   }
   else {
    return true
   }
  }
    // End hiding script -->
   
  
  #menu1 {display:none; margin-left:20px}
     

  
Update The
Record


  
  
<br>      Update the record<br>    
 [input]  [input] 




";
?>






 

       
---------------------------------
Give spam the boot. Take control with tough spam protection
in the all-new Yahoo! Mail Beta.

--- End Message ---
--- Begin Message ---
Hi

> In PHP when you click on the menu text Update The Record the menu doesn’t 
> open it takes you to another page. But in HTML when you click on the menu 
> text Update The Record the menu dose open.

Clicking on the "Update the Record" link does the same for me in either
PHP/HTML versions.  Takes me to the linked (non-existant) page.

As I already pointed out, your example has parts missing, I can only
assume there is more missing than I can guess at from the pieces that
are present.


Niel

--- End Message ---
--- Begin Message ---
> It works with HTML without body

Technically, both html and body tag pairs are optional, but it make your
page clearer to understand when included.

First thing I'd suggest is NOT using echo. As far as I can see you have
no dynamic content being produced, so put the whole lot before the "<?php"
tag.

If you must use echo then do it like this:

<?php
echo <<<END
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE=JAVASCRIPT>
  <!-- Hide script from older browsers
    function toggleMenu(currMenu) {
   if (document.all) {
    thisMenu = eval("document.all." + currMenu + ".style")
    if (thisMenu.display == "block") {
     thisMenu.display = "none"
    }
    else {
     thisMenu.display = "block"
    }
    return false
   }
   else {
    return true
   }
  }
    // End hiding script -->
 </SCRIPT>
 <STYLE TYPE="TEXT/CSS">
  #menu1 {display:none; margin-left:20px}
   </STYLE>
  <H3>
 <A HREF='page1.html' onClick='return toggleMenu("menu1")'>Update The Record</A>
</H3>
<SPAN ID='menu1'>
 <FORM>
    <P>
    <TEXTAREA name='hetext' rows='10' cols='40'>
      Update the record
    </TEXTAREA>
    <INPUT type='submit' value='Update'><INPUT type='reset'>
    </P>
 </FORM>
</SPAN>
END;
?>

Tested and works on Opera


Niel

--- End Message ---
--- Begin Message ---
sam rumaizan wrote:
In PHP when you click on the menu text Update The Record the menu doesn’t open 
it takes you to another page. But in HTML when you click on the menu text 
Update The Record the menu dose open.
<A HREF='page1.html' onClick='return toggleMenu('menu1')'>Update The Record</A>
</H3>

When you try the PHP version, do a "View Source" in your browser. If you can see the PHP code then you haven't set your web server up to process PHP files. I'm guessing this is causing the Javascript block at the top of your script to be ignored by the browser.

If that's not the case then you need to explain exactly how you are running the PHP version.

-Stut

--- End Message ---
--- Begin Message ---
Spam detection software, running on the system "mail.enchantedspirit.com", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
[EMAIL PROTECTED] for details.

Content preview:  and tags might help Niel [...] 

Content analysis details:   (6.0 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.1 HTML_TEXT_AFTER_BODY   BODY: HTML contains text after BODY close tag
-2.6 BAYES_00               BODY: Bayesian spam probability is 0 to 1%
                            [score: 0.0000]
 1.6 HTML_SHORT_LENGTH      BODY: HTML is extremely short
 0.4 HTML_30_40             BODY: Message is 30% to 40% HTML
 0.0 HTML_MESSAGE           BODY: HTML included in message
 2.0 RCVD_IN_SORBS_DUL      RBL: SORBS: sent directly from dynamic IP address
                            [82.32.121.60 listed in dnsbl.sorbs.net]
 1.9 RCVD_IN_NJABL_DUL      RBL: NJABL: dialup sender did non-local SMTP
                            [82.32.121.60 listed in combined.njabl.org]
 2.5 HTML_MISSING_CTYPE     Message is HTML without HTML Content-Type


--- Begin Message ---
and <BODY></BODY> tags might help

Niel


--- End Message ---

--- End Message ---
--- Begin Message ---
Yes I do have dynamic content in my page. 
  I’m attaching the whole code for this page.
   
  
<---------------------------------Start----------------------------------------------->
   
  
<?php
  echo "
  <SCRIPT TYPE='TEXT/JAVASCRIPT' LANGUAGE=JAVASCRIPT>
  <!-- Hide script from older browsers
    function toggleMenu(currMenu) {
   if (document.all) {
    thisMenu = eval('document.all.' + currMenu + '.style')
    if (thisMenu.display == 'lock') {
     thisMenu.display = 'none'
    }
    else {
     thisMenu.display = 'block'
    }
    return false
   }
   else {
    return true
   }
  }
    // End hiding script -->
 </SCRIPT>
 <STYLE TYPE='TEXT/CSS'>
  #menu1 {display:none; margin-left:20px}
   </STYLE>
   
  
";
  
echo"
<TABLE ALIGN='center' BORDER='0' CELLSPACING='0' CELLPADDING='0'>
  <TR ALIGN='center' VALIGN='middle'>
  
<TH ALIGN='center'>
  <FONT SIZE='6' COLOR ='#310032'>
  
View Existing Data
  </FONT>
  
</TH>
</TR>
</TABLE>";
$page_title = 'View Existing Data';
include ('./includes/header.html');
   
   
  echo"<form  method='post' action=ved.php'>";
   
   
  include( '../mysql_connect.php' );
  echo"<CENTER>";
include ('./includes/footer.html');
echo"</CENTER>";
     $query = "SELECT   DISTINCT Assign_Engineer FROM  lo_data";
   $result = mysql_query($query);
   
  echo"<center>
<br> <br>"
;
  
echo"<select NAME='R'>";
echo"<option value='NULL'>Choose a Category:</option>
";
   while ($line = mysql_fetch_array($result))
   {
      foreach ($line as $value)
       {
  
         echo"<OPTION value='$value'";
        }
  echo ">$value</OPTION>";
  
   }
  
echo "</SELECT>";
echo"<input  type='submit' name='Submit' value='Submit Data'>";
   
  echo"<br> <br>";
   
   
  if (isset($_POST["R"])) {
  
$result = mysql_query("SELECT Ref_No, 
Job_Title,Category,Assign_Engineer,Date_Received,Date_Required,Date_Assigned,ProjectedCompletionDate,Date_Completed,ManhourSpent,Status
 FROM  lo_data WHERE Assign_Engineer ='".$_POST["R"]."'");
}
echo"<div style='overflow:auto; '>";
echo"
  <table  width='80' border='1' cellspacing='1' cellpadding='3' bordercolor= 
'CDCB98'>
  <thead>
  <tr style='position:relative; 
top:expression(this.offsetParent.scrollTop);background-color:CDCB98;'>
   <th>Reference No</th>
   <th>Job Descriptions</th>
   <th>Category</th>
   <th>Assign Engineer</th>
   <th>Date Received</th>
   <th>Date Required</th>
   <th>Date Assigned</th>
   <th>Projected Completion Date</th>
   <th>Date Completed</th>
   <th> Manhour Spent</th>
    <th>Status</th>
  </tr>
 </thead>
  
";
  
while($row = mysql_fetch_array($result))
    {
  echo "<tbody>";
    echo "<tr VALIGN='TOP' ALIGN='CENTER'>";
    echo "<td>" . $row['Ref_No'] ."<br> <H3>
 <A HREF='page1.html' onClick='return toggleMenu('menu1')'>Update The Record</A>
</H3>
<SPAN ID='menu1'>
 <FORM>
    <P>
    <TEXTAREA name='text' rows='10' cols='40'>
      Update the record
    </TEXTAREA>
    <INPUT type='submit' value='Update'><INPUT type='reset'>
    </P>
 </FORM>
  
</SPAN>
  </td>";
  echo "<td>" . $row['Job_Title'] . "</td>";
  echo "<td>" . $row['Category'] . "</td>";
  echo "<td>" . $row['Assign_Engineer'] . "</td>";
  echo "<td>" . $row['Date_Received'] . "</td>";
  echo "<td>" . $row['Date_Required'] . "</td>";
  echo "<td>" . $row['Date_Assigned'] . "</td>";
  echo "<td>" . $row['ProjectedCompletionDate'] . "</td>";
  echo "<td>" . $row['Date_Completed'] . "</td>";
  echo "<td>" . $row['ManhourSpent'] . "</td>";
  echo "<td>" . $row['Status'] . "</td>";
  echo "</tr>";
 echo"</tbody>";
  }
  echo "</table>";
echo"</div>";
echo"<br>";
  echo"<br>";
  echo "</form>";
  mysql_close();
  
?>
   
   
  
<---------------------------------End----------------------------------------------->





 

       
---------------------------------
You snooze, you lose. Get messages ASAP with AutoCheck
 in the all-new Yahoo! Mail Beta. 

--- End Message ---
--- Begin Message ---
> Yes I do have dynamic content in my page. 
>   I’m attaching the whole code for this page.

 You missed the point. The fragment you supplied had no dynamic content
so does not need to be echoed at all. It can simply exist outside the
<?php ?> tag structure.

Niel

--- End Message ---
--- Begin Message ---
i have a 12 digit code that i want to format as follows xxxx-xxxx-xxxx it is 
all numbers i tried using substr() to format it in this fassion
$code = abcdwxyz8765;
$string = array();
$string[] = substr($code,1,4);
$string[] = substr($code,5,8);
$string[] = substr($code9,12);
echo $string[0],'-',$string[1],'-',$string[2];
OUTPUT SHOULD BE : abcd-wxyz-5678
I GET : -wxyz678-5678
Any help? 

--- End Message ---

Reply via email to