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 8042935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:44:57+00:00 2026-06-05T04:44:57+00:00

I am creating a form where I am using $_POST php function. Here is

  • 0

I am creating a form where I am using $_POST php function.

Here is how my form looks like.

form.php

<h1>Songs Movies Form</h1>
<hr />

<form action="songs-movies.php" method="post">

Song Name:
Enter Song Name: <input type="text" name="SongName" size="25" />

Enter Movie Name: <input type="text" name="MovieName" size="25" />

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

</form>

<br />
<a href="/forms/">Back to Forms</a>
<hr />

Now I want to display result of SongName and MovieName, so I used echo $_POST[“SongName”]; and echo $_POST[“MovieName”]; which generates the result perfectly.

Now I want to put these values SongName and MovieName between the text/line/para in the result/output page and if the value of SongName or MovieName is empty then the result/output should not display that specific text/line/para where I have put those functions.

e.g.


ABC Song is the popular Song of the XYZ Movie. The ABC Song of XYZ Movie is directed by PQR Director.


Now you can see there are two sentences in the above Para. I want to put the function for the first sentence only when the field values of SongName and MovieName are empty then

  • It should display the first sentence whether the field values of SongName and MovieName is empty or not i.e. ABC Song is the popular Song of the XYZ Movie. If the field values of SongName and MovieName are empty then it can leave blank space between them and I know it can be done through this function echo $_POST[“SongName”];.

BUT

  • It should not display the first sentence line if the field values of SongName and MovieName are empty i.e. The ABC Song of XYZ Movie is directed by PQR Director.
  • 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-06-05T04:44:58+00:00Added an answer on June 5, 2026 at 4:44 am

    I think what you are looking for is something like:

    if(!empty($_POST['foo'])) {
       echo "a sentence".$_POST['foo']." with something in the middle.";
    }
    

    This will check that the value is NOT empty, however empty means a lot of things in PHP so you may need to be more specific. For example you may want to check simple if its set:

    if(isset($_POST['foo'])) {
       echo "a sentence".$_POST['foo']." with something in the middle.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a registration form using PHP and jquery with ajax. Each field
I am creating a multipage form in PHP, using a session. The $stage variable
I'm creating a form using the form builder in Symfony. I am adding an
I am creating a nested form and using Ryan Bates Railscast. I am creating
I am creating a select box for a form using this in _form.html.erb <%=
I am creating an user registration form using jsp,in which there is an option
I'm using WPF for creating my application, I am calling a windows form using
I am creating a form dynamically from the fields returned from server using json
I'm creating a basic form with ajax submit using jquery framework. This is my
I've created my own signup form and creating the user using the Membership class.

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.