Jump to content

a for loop in a page to create values


clankill3r

Recommended Posts

First of all i create the page to copy the buttons as pixels to paste into a design, it's not for a working webpage.

 

It goes wrong here,

<option value="0">Day</option>

<?= for(var i=0; i<31; i++){?>

<option value="<?=i?>"><?=i?></option>

<?= } ?>

</select>

 

 

 

<?php


?>
<html>

<head>
<title>Community Development Project</title>
</head>

<body>
<div id="container">
	<form id="opties1" name="opties1" method="post" action="something.php">
		<div class="forminput">
			<input type="button" id="signin" name="signin" value="Sign In" /> <br/> <br/>
			<input type="button" id="register" name="register" value="Register" /> <br/> <br/>
			<input type="button" id="uploadimage" name="uploadimage" value="Upload Image" /> <br/> <br/>
			<input type="button" id="next" name="next" value="Next" /> <br/> <br/>
			<input type="button" id="addanother" name="addanother" value="Add Another" /> <br/> <br/>
			<input type="button" id="register" name="register" value="Register" /> <br/> <br/>
			<input type="button" id="create" name="create" value="Create" /> <br/> <br/>
			<input type="button" id="addfolder" name="addfolder" value="Add Folder" /> <br/> <br/>
			<input type="button" id="addimage" name="addimage" value="Add Image" /> <br/> <br/>
			<input type="button" id="addtask" name="addtask" value="Add Task" /> <br/> <br/>
			<input type="button" id="cancel" name="cancel" value="Cancel" /> <br/> <br/>
			<input type="button" id="watch" name="watch" value="Watch" /> <br/> <br/>
		</div>
	</form>

	<form id="opties2" name="opties2" method="post" action="something.php">
		<div class="forminput">
			<select id="day" name="day">
				<option value="0">Day</option>
				<?= for(var i=0; i<31; i++){?>
				<option value="<?=i?>"><?=i?></option>
				<?= } ?>
			</select>

			<select id="country" name="Country">
				<option value="0">Netherlands</option>
				<option value="1">Germany</option>
				<option value="2">Belgium</option>
			</select>

		</div>
	</form>


</div>
</body>

</html>


Link to comment
Share on other sites

You cannot use the <?= in the way you have, <?= is an ECHO shortcut. You also seem to be using a more Javascript variable style :)

Variables are preceded with a $ and do not require the 'var' part.

Try this

<option value="0">Day</option>
   <?php for($i=0;$i<31;$i++){ ?>
   <option value="<?=$i?>"><?=$i?></option>
   <?php } ?>
</select>

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.