www.webdeveloper.com
Results 1 to 7 of 7

Thread: How to make contact form PHP_SELF into the same page?

  1. #1
    Join Date
    Sep 2005
    Posts
    1,626

    Question How to make contact form PHP_SELF into the same page?

    I have code to submit form like:
    <form id="remove" action="<?php echo $PHP_SELF; ?>" method="post" >
    If there is management of files with detection of ID, how to influence that it will not go on index.php page as it should be index.php?id=contact_reply1

    It seems that posting message goes file to index.php and NOT detecting ID number or/and value.

    Is possible to manage this redirection when submitting message?

    Need help

  2. #2
    Join Date
    Dec 2005
    Posts
    2,984
    PHP Code:
    <?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

  3. #3
    Join Date
    Sep 2005
    Posts
    1,626
    Thank you. It works perfect.

    How to change also redirection within javascript and link incluedes PHP script?
    Is possible to include PHP within Javascript?

    See sample:
    <?PHP
    "<script language='javascript'>
    document.location='<?=$_PATH10 ?>index.php?id=ContactReply1';
    </script>";

    ?>
    Last edited by toplisek; 12-12-2008 at 08:57 AM.

  4. #4
    Join Date
    Sep 2004
    Location
    Sri Lanka
    Posts
    469
    PHP Code:
    <?php
    ...

    ...

    $url 'http://www.webdeveloper.com/forum/newreply.php?do=newreply&noquote=1&p=959499';

    ?>
    <html>
    <head>
    ....

    <script language="javascript">
        window.location = '<?=$url;?>';
    </sctipt>
    </head>
    <body>
       ....
       .....

    </body>
    </html>
    And save as a PHP file.

  5. #5
    Join Date
    Sep 2008
    Posts
    16

    PHP can be included in Javascript

    Hi..

    Ya, its possible to insert a php code in the javascript.

    Check this out.

    <?php
    $no=1;
    ?>

    <script>
    alert(<?php echo $no; ?>);
    </script>


    This will surely give an alert box.
    In a similar fashion one can write in any sort of php code with <script></script>..


    cheers..

  6. #6
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    Can I just point out that I have never found a single browser that demands a file name when specifying a query string, you can get away with:
    PHP Code:
    <?php echo '?'.$_SERVER['QUERY_STRING']; ?>
    I've been using this short cut for a long time, there's nothing wrong with it as far as I can tell(and I test everything in IE5, 6+7, firefox 1.5+, opera 9, latest safari, konqueror, lynx, links and w3m), I've not had problems with it in over 3 years.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  7. #7
    Join Date
    Sep 2005
    Posts
    1,626
    Thank you

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