I create a form where I use the php function $ _POST.
This is what 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 the result of SongName and MovieName , so I used echo $ _POST ["SongName"]; and echo $ _POST ["MovieName"]; which perfectly generates the result.
Now I want to put these SongName and MovieName values between the text / line / pairs on the result / output page, and if the SongName or MovieName value is empty, then the result / result should not display this text / line / pair where I put these functions.
eg.
ABC Song is a popular XYZ Movie song. XYZ's ABC Song film is managed by the PQR Director.
Now you can see that in the paragraph above there are two sentences. I want to put a function for the first sentence only when the values โโof the SongName and MovieName fields are empty, and then
- The first sentence should display whether the SongName and MovieName fields are empty or not. Those. ABC Song is a popular XYZ Movie song. If the values โโof the SongName and MovieName fields are empty, then it can leave a space between them, and I know that this can be done using this function echo $ _POST [SongName "] ;.
BUT
- It should not display the first line of the sentence if the values โโof the SongName field and the movie name are empty, i.e. ABC Song of XYZ Movie is managed by the director of PQR.
source share