Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

execute php inside javascript code.

Posted on 2007-11-19
5
Medium Priority
?
2,381 Views
Last Modified: 2008-02-01
I have the following piece of javascript/php.  It doesn't work.  Any thoughts?  Oh and the javascript is inside a .js file and I can't put the javascript inside the browser script tags.
var postForm =
                  '<form id="ys-post-form"' + (this.prefs.inverse ? 'class="ys-inverse"' : '' ) + '><fieldset>' +
                        '<input id="ys-input-nickname" value="<?php echo $userdata['username']; ?>" type="text" accesskey="N" maxlength="' + this.prefs.nicknameLength + '" class="ys-before-focus" />'
0
Comment
Question by:casit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 20317824
try rename that js file to .php and try again?
0
 

Author Comment

by:casit
ID: 20317855
Sorry meant to say that I did try renaming it and still the same results.
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 20318004
try change lines:

<script src="yshout/js/yshout.php" type="text/javascript"></script>

to:

include('yshout/js/yshout.php');

and inside yshout/js/yshout.php, add:

<script language="javascript">

at top and,

</script>

at the bottom of the file.


see if this works?
0
 

Author Comment

by:casit
ID: 20318166
No that didn't work but unfortunatelty this feature has been moved down to the bottom of the project list at the moment.  I will however award you the points.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question