10 Line Checkbox

I want to create a form with ten lines and the option to set a numeric value per line from 1 to 10 with checkboxes

But, there can be no duplicate numbers; each line must have a unique numerical value. I would like to save it as a .txt file and display it in HTML.

Could someone help me develop the code and discuss other options, like having a dropdown menu with values 1 to 10.

Sorry, but I’m struggling to understand what you want here … you might have to draw us a picture …

Do you mean that there are 10 options, and visitors have to rank them in order 1–10?
I’m not sure where the .txt file comes into things …

This is definitely for javascript forum. You should ask a mod to move it over there.

Do you want to do this server side using php?

Javascript can’t save files. I’ve moved this thread to the PHP forum :slight_smile:

<html>
<body>

<form action=“Levels.php” method=“post”>

Level1:

<Select Name=“Aggression”>
<option value=“10”>10</option>
<option value=“9”>9</option>
<option value=“8”>8</option>
<option value=“7”>7</option>
<option value=“6”>6</option>
<option value=“5”>5</option>
<option value=“4”>4</option>
<option value=“3”>3</option>
<option value=“2”>2</option>
<option value=“1”>1</option>

</select>

</form>

</body>
</html>

Here’s the basic code. But, I want there to be 10 Levels in a game, and wish to set an aggression from 1-10. Once I set the aggression in a level, that value can no longer be used in any remaining level. I want to be able to save the data to a .txt file and re-call it in html on the server side.

Why a text file? This is starting to sound like you need a database.

Iteration like this is a basic for loop.


<?php for ($i = 1; $i < 11; $i++): ?>
<option value="<?php echo $i ?>">Level <?php echo $i ?></option>
<?php endfor ?>