Jump to content

[SOLVED] multiple forms problem with POST


wrathican

Recommended Posts

hey im trying to make a list of files (with preview) that a user can delete.

 

im using a while loop to print out a form for each object

 

so my form looks like this;

<div class="gallery"> <img src="/images/thumbs/94df6028b5acc2bf05025e41c443842c.jpg" alt="fest" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="1" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/df5e2c697355f9f89f86e3685db39d46.jpg" alt="bike" /><br /><br />

			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="2" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/9ff39043180c3f7f207aa7d44c170d3c.jpg" alt="camel" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="6" />
		    <input type="submit" name="delete" value="Delete" />

			</div>
		  				<div class="gallery"> <img src="/images/thumbs/7ee02c36b4a3f2ad72bea299fb8f1165.jpg" alt="shlurple" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="7" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/05b15575a5796f5b7cc4f3482df965ba.jpg" alt="prom" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >

		    <input type="hidden" name="picid" value="8" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/f25a0f0500e652ee33d7a2580398937a.jpg" alt="turkey" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="9" />
		    <input type="submit" name="delete" value="Delete" />
			</div>

		  				<div class="gallery"> <img src="/images/thumbs/9aed3dde749be8b4fc42b4699c9915e8.jpg" alt="kiss" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="10" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/69d8d91df6b58073a237fb6016c210d5.jpg" alt="birthday" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="11" />

		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/c52e8b432b5ee91a899b74422c6c8875.gif" alt="kiss2" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="12" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/8a7845278c3ec3a007c9d9b123454bb9.jpg" alt="slide" /><br /><br />

			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="13" />
		    <input type="submit" name="delete" value="Delete" />
			</div>
		  				<div class="gallery"> <img src="/images/thumbs/3c9ae3da7d7843c4da74ec2db8629374.jpg" alt="jump" /><br /><br />
			<form method="post" enctype="multipart/form-data" name="delpic" action="/functions/adminfunctions.php?func=delimage" >
		    <input type="hidden" name="picid" value="14" />
		    <input type="submit" name="delete" value="Delete" />

			</div>

the problem is that the 'picid' value is always what the last value printed was. im thinking this is because the inputs all have the same name so the last printed value is assumed.

 

how do i over come this without deleting all of the pictures and not having to run a check through a hundred possible vule names?

Link to comment
https://forums.phpfreaks.com/topic/116476-solved-multiple-forms-problem-with-post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.