473,396 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

php within javascript tags

160 100+
can we write php in javascript tag like this

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function abc()
  3. {
  4. <?
  5. echo "aaaaaaaaaaaaaaaaaaaa";
  6. ?>
  7. }
  8. </script>
  9.  
Jan 29 '09 #1
9 5014
Dormilich
8,658 Expert Mod 8TB
do you encounter any problems therewith?
Jan 29 '09 #2
waqasahmed996
160 100+
yes unable to print anything within php tags
Jan 29 '09 #3
Dormilich
8,658 Expert Mod 8TB
have you short tags enabled in your php.ini? do you get any Error Messages? (if activated).
Jan 29 '09 #4
waqasahmed996
160 100+
short tags is not enabled in php.ini
Jan 29 '09 #5
Dormilich
8,658 Expert Mod 8TB
therefore PHP doesn't recognise your code.


-- I'll move this thread over to the PHP forum
Jan 29 '09 #6
waqasahmed996
160 100+
how can i enable short tags

and after enabling short tags my code will work which i have sent in my first message??
Jan 29 '09 #7
Dormilich
8,658 Expert Mod 8TB
there's an even simpler solution: use php tags!
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // code goes here ...
  3. ?>
Jan 29 '09 #8
Markus
6,050 Expert 4TB
Open your php.ini file. Search for 'short_open_tag'. Set it's value to On.

Be warned: not every server will have these enabled. So, if you're going to be moving around servers, porting your scripts, you should not rely on these.
Jan 29 '09 #9
@waqasahmed996
if you're using xampp to enable php short tag just go to xampp\php\php.ini

go find short_open_tag = Off

and change the status to be on
May 6 '13 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? ...
1
by: relaxedrob | last post by:
Howdy All! I am really stuck with this one - I want to completely create a table within JavaScript and insert it into the document, with onMouseOut and onMouseOver handlers in the table rows. ...
2
by: North Country Boy | last post by:
Hi I'm trying to run the mail merge operation in MS Word from within Javascript. I've already done this in VB but I'm having problems trying to do the same thing in Javascript. First I am trying...
2
by: bentley | last post by:
I need to print a browser page and configure the print dialog settings.  I am using the JavaScript window object with the print method (window.print() ).  From what I understand and have read in...
1
by: mike c | last post by:
I have a search app that searches local HTML files for a specified term. I then display the pages that contain the term. I would like to highlight the search term within the HTML when it is...
9
by: misdst23 | last post by:
Hi, I know I can call a static java method within javascript by using the <% ... %tags. But how can pass a javascript variable ? function thefunction() { var = javascriptvariable ;
3
by: analwarsi | last post by:
Hi, i am new to javascript. actually i need to execute the wget command from within a javascript code, but i don't know the syntax for executing the linux-ccommands from within javascript code....
4
by: Steve | last post by:
Hi, I'm a complete PHP n00b slowly finding my way around I'm using the following function that I found on php.net to strip out html and return only the text. It works well except for when you...
9
by: Morlaath | last post by:
Is there a way to embed php within javascript code? I know that php is server side and js is client side. For instance when working with jsp, you can imbed jsp scriptlets within the js code. e.g...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.