samedi 9 janvier 2016

PHP: connect drop-down list with submit button and if/else statemant

So, to explain my question. I have four .php codes on web server, and I have drop down list in php code also (it includes name of all four php files that are on server). I have also submit button.

I should do following: User choose one name from drop down list, click submit button, and than that php file should be called and shown on web page.

The problem is, I don't know hot to connect these three part of php code.

<p>
  What Genre you want?
<select name="Ganre">
  <option value="">Select...</option>
  <option value="FPS">FPS</option>
  <option value="JRPG">JRPG</option>
  <option value="RPG">RPG</option>
  <option value="Sports">Sports</option>
</select>
<input type="submit" value="Submit" />

<if (Genre == "FPS") { ?>
<form method="get" action="FPS.php"}>
  <else if (Genre == "JRPG") { ?>
  <form method="get" action="JRPG.php"}>
    <else if (Genre == "RPG") { ?>
    <form method="get" action="RPG.php"}>
      <else if (Genre == "Sports") { ?>
      <form method="get" action="Sports.php"}>
</p>

I searched on forum a lot, but I couldn't find solution.

Aucun commentaire:

Enregistrer un commentaire