Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3628342
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:00:17+00:00 2026-05-19T00:00:17+00:00

In index.php theres a link where it makes a ajax request to show.php .

  • 0

In index.php theres a link where it makes a ajax request to show.php. In show.php, I took this form:

<div id="statuscomments" style="margin: auto; ">
    <form id="RespondMsg<?php echo $id; ?>" action="javascript:ReplyToWall(<?php echo $grabwall["BuID"]; ?>, <?php echo $id; ?>)" method="post">
        <textarea name="replyMsg" type="text" style="text-align: left;" class="replyMsg<?php echo $id; ?>" rows="2" cols="42"></textarea>
        <br>
        <input name="submit" type="submit" id="submitResponse" value="Skicka">
        <br>
        <div class="response<?php echo $id; ?>"></div>
    </form>  
</div>

and wrapped it inside a php function that I named replyFormShow(), now it looks like this:

function replyFormShow(){
?>
<div id="statuscomments" style="margin: auto; ">
    <form id="RespondMsg<?php echo $id; ?>" action="javascript:ReplyToWall(<?php echo $grabwall["BuID"]; ?>, <?php echo $id; ?>)" method="post">
        <textarea name="replyMsg" type="text" class="replyMsg<?php echo $id; ?>" rows="2" cols="42"></textarea>
        <br>
        <input name="submit" type="submit" id="submitResponse" value="Skicka">
        <br>
        <div class="response<?php echo $id; ?>"></div>
    </form>  
</div>
<?php
}
?>

When I call call replyFormShow() this form will now show.

Now the form is running the JS function replyToWall() on submit, but this stops working now when Its inside a function, so now it does not run the js function replyToWall().

The function replyToWall() is inside functions.js, that are not called in show.php but in index.php. But this shouldnt be why it is not working as It works fine when its not inside this PHP function replyFormShow().

Why is this happening? How can i solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:00:17+00:00Added an answer on May 19, 2026 at 12:00 am

    You need to have a placeholder div in your index.php, which Javascript code in show.php will place the form acquired from the server into it.

    Something like this:

    index.php

    <div id="holder"></div>
    <script type="text/javascript">
        function loadform(){
            $.get('show.php', [], function(data){
                $("#holder").html(data); // load the returned form into placeholder.
            });
        }
    </script>
    <a href="#" onclick="loadform();return false;"></a>
    

    I am using jQuery for example to save time. See http://api.jquery.com/jQuery.get/ for details on the $.get() AJAX GET function in jQuery,

    show.php

    <?php
    function replyFormShow($id, $buddyId){
    
    $test = '<div id="statuscomments" style="margin: auto; ">
        <form id="RespondMsg' . $id . '" action="javascript:ReplyToWall('.$buddyId.', '.$id.')" method="post">
            <textarea name="replyMsg" type="text" class="replyMsg' . $id . " rows="2" cols="42"></textarea>
            <br>
            <input name="submit" type="submit" id="submitResponse" value="Skicka">
            <br>
            <div class="response' . $id . "></div>
        </form>  
    </div>';
    return $test;
    
    }
    
    echo replyFormShow(0, 0);
    ?>
    

    And I see you are very confused with Javascript and PHP open/close tags. And a very bad practice to deadlock forms with Javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

index.php has this jquery code which loads notifications.inc.php into a div on the page
Is there a possible htaccess directive that can transparently forward request from index.php to
I have folder home/admin. In this folder there is index.php. When i access to
index.php: <form action=update_db.php method=post> <?php require_once 'modules/' . $currentModule . '.php'; ?> </form> modules/
From http://projecteuler.net/index.php?section=problems&id=99 Comparing two numbers written in index form like 2 11 and 3
how can i redirect index.php?search= to the base url? I tried it with this
Let say we have link as following for link as ****.com/index.php?id=4 the <?=$id?> is
File structure is as follows: index.php settings/ |-manage_account.php templates/viriditio-v2/ |-index.tpl templates/virditio-v2/css |-style.css localhost/~braden/virditio/index.php shows
There is index.php and logo.gif files in my server. I need to change the
is there a demo for the FanBox? http://wiki.developers.facebook.com/index.php/Fan_Box I would like to include it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.