SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php link into Js script , how plz help ?!

    [php]
    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->
    </script>
    <?
    if($st_name =="" and $nd_name ==""){
    echo "<script language=\"JavaScript\">";
    echo "MM_openBrWindow('error.php&st_name=$st_name','','width=300,height=130');";
    echo "</script>";
    } ?>
    [/code]

    the error that the script is looking for file with name ' error.php&st_name=$st_name ' , how can i make it to know that the file name just error.php ?

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    echo "MM_openBrWindow('error.php,'','width=300,height=130');";
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    i know that !!
    i need to pass the var. as $st_name to the pop-up windows !
    this what i need !

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If $st_name does not have a value your script will always go to the url error.php&st_name

    If $st_name does have a value your script wont do anything. Do you mean:

    PHP Code:
    if($st_name !=="" and $nd_name !==""){ 
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the idea which am working on !

    i have 4 file (getit.htm,getit.php, error.php,ok.php) , getit.htm which include simple form, with st_name and nd_name, the form action is going to getit.php, this file will check if the fields empty pr not, if not will make pop-up windows the ok.php or error.php .

    so i need to pass the st_name, and nd_name to the pop-up windows, is that possible ?

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, use your code but change the one line to the code I posted above

    Note: There is a forum specifically for PHP questions here http://www.sitepointforums.com/forum...php?forumid=34

    Sean
    Last edited by seanf; Oct 7, 2001 at 08:15.
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not this the problem !
    the prob is looking for file 'error.php&st_name=&st_name'
    he take it all as file name !

  8. #8
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Richi
    not this the problem !
    This is your code with the line changed and me decalring the avriable myself. Please try it:

    PHP Code:
    <?php

        $st_name 
    ="sean";

    ?>

    <script language="JavaScript"> 
    <!-- 
    function MM_openBrWindow(theURL,winName,features) { //v2.0 
    window.open(theURL,winName,features); 

    //--> 
    </script> 
    <? 
    if($st_name !=="" and $nd_name !==""){ 
    echo 
    "<script language=\"JavaScript\">"
    echo 
    "MM_openBrWindow('error.php&st_name=$st_name','','width=300,height=130');"
    echo 
    "</script>"
    ?>
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  9. #9
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry !
    maybe u didn`t get the point until now.

    the prob not with this line :
    PHP Code:
    if($st_name =="" and $nd_name ==""){ 
    this line will check if the $st_name and $nd_name filled in or not !

    the probelem is gonna take all the file name and the var. as 1 word as file name .

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just spotted this:

    error.php&st_name=$st_name

    Needs to be:

    error.php?st_name=$st_name

    You do need to change that line though. What your code is doing is opening the window with the value $st_name only if $st_name does not have a value

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok found it

    thx alot !!!


Bookmarks

Posting Permissions

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