Jump to content

Recommended Posts

I want to have it setup so when the user clicks this link a value is sent via get and that value is put through a for loop to generate an additional form field:

 

if(isset($_GET['add_upload']) && is_numeric($_GET['add_upload'])) {
			$add_upload = $_GET['add_upload'];
			$add_upload+1;
			if ($add_upload > 0) {
				for($i=1; $i <= $add_upload; $i++) {
					echo 'upload'.$i;
				}
			}
		}
	?>
	<a href="<?php echo $_SERVER['PHP_SELF'].'?add_upload='; if (isset($add_upload)) { echo $add_upload; } else { echo 1; } ?>">Click Here To Add Another Upload Field</a>

 

The value keep returning as 1. Can anyone give this a second look and let me know what I am missing.

Link to comment
https://forums.phpfreaks.com/topic/74800-dynamic-form-fields/
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.