Jump to content

Simple HTML submit form using PHP not working


shilpa

Recommended Posts

Hi,

I am learning PHP now, so pardon my silly question which I am not able to resolve from a week. I have created a simple web form where in I display the values entered by a user.

 

 

<form action ="reply.php" id="myForm" method="post" >

      Name: <input type="text" name="name" size="25" maxlength="50" /> <br> </br>

      Description: <textarea name="editor1"> </textarea>

      <input type="submit" value="Submit"  />

</form>

 

and reply.php contains:

<?php

    echo "In reply page";

 

    foreach($_POST as $field => $value)

  {

        echo "$field = $value";

  }

?>

 

When I click on the submit button, I just get a blank page without any values from the form. Can anyone please let me know what am I missing?

 

Set up:

I am using Netbeans with PHP bundle added on to it. When i run only a simple php proj it displays that page in localhost/nameofproj, but when I run a php file along with a jsp file, it runs in localhost:8080/nameofproj.  Is this the reason(localhost:8080 instead of just localhost ) for showing a blank page, not even a simple echo stmt, when i click on submit?

I even re installed netbeans, still no luck.

 

Thanks in advance.

Link to comment
Share on other sites

Try putting some id's in the form..

 

<form action ="reply.php" id="myForm" method="post" >
      Name: <input type="text" name="name" id="name" size="25" maxlength="50" /> <br> </br>
      Description: <textarea name="editor1" id="editor1"> </textarea>
      <input type="submit" value="Submit"  />
</form>

Link to comment
Share on other sites

I did put id to forms and try. Forms are coming fine. Problem is only after i click on submit  button in the form. After i click on submit it shows a blank page.

The url after submit brings me to http://localhost:8080/sampleproj/reply.php, thats correct as in forms action i have given it as reply.php

If i put the php page alone as a separate proj, it works fine. the url then is http://localhost/reply.php

 

I installed netbeans again but still no luck, I am not understanding what am i doing wrong.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.