www.webdeveloper.com
Results 1 to 3 of 3

Thread: Passing Values

  1. #1
    Join Date
    Feb 2011
    Location
    Waterloo, Ontario, Canada
    Posts
    80

    Passing Values

    I guess this could be a PHP problem or a Javascript problem, depending on what I'm doing wrong but here it goes:

    <script language="javascript" type="text/javascript">

    window.top.window.stopUpload(<?php echo $errors;?>, <?php echo $newname;?>);

    </script>

    For some reason I can't pass the newname. Passing $errors (which is an integer) works fine. But passing $newname (which is a string) does not.

    I even tried hard-coding it to:
    PHP Code:
    window.top.window.stopUpload(<?php echo $errors;?><?php echo '123456.jpg';?>);
    with no results. However,
    PHP Code:
    window.top.window.stopUpload(<?php echo $errors;?>, '123456.jpg'>);
    does work. Which is nice, but I need to use php because it's a variable, not a hard-coded image every time. And by the others not working, I mean literally the value doesn't get passed.
    Last edited by Galway; 05-17-2011 at 06:46 PM.

  2. #2
    Join Date
    Oct 2010
    Location
    Ohio
    Posts
    233
    PHP Code:
    window.top.window.stopUpload(<?php echo $errors;?>, '<?php echo $newname;?>');
    Notice the quotes around the php echo $newname, which will put the echo in quotes in the finished product. As it stands now it is not in quotes, probably the problem.
    ~Ryan
    www.rdennispallas.com <-- Personal Site, changing regularly cuz its ugly.

  3. #3
    Join Date
    Feb 2011
    Location
    Waterloo, Ontario, Canada
    Posts
    80
    Quote Originally Posted by Derokorian View Post
    PHP Code:
    window.top.window.stopUpload(<?php echo $errors;?>, '<?php echo $newname;?>');
    Notice the quotes around the php echo $newname, which will put the echo in quotes in the finished product. As it stands now it is not in quotes, probably the problem.
    Those were unfortunately just a typo in my question.

    EDIT: Oooooh. I seeee. Thanks I'll give that a try.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles