Jump to content

Recommended Posts

Hi,

I am trying to limit the amount of photo's a user can upload the code I wrote for my html.php page doesn't work because it always displays a submit button. I would like it to display either a plain text message or a submit button.

Disregard the fact that no values are being passed to my if test, my actual code is longer and passes the correct values so that the test works.

 

<tr>

<td colspan="2"><input type="submit" class="button" value="<?php

if ( $images_total < "3" ) {

echo "_UPLOAD_SUBMIT";

{

else {

 

echo "You have reached your upload limit";

}

 

{

}

?>" /></td>

</tr>

Link to comment
https://forums.phpfreaks.com/topic/191637-limiting-user-uploads/
Share on other sites

Well, first of all $images_total should be an integer, not a string. Adding the quotes make it a string so using the greater than or less than comparison operators won't work here.

 

<tr>
            <td colspan="2"><input type="submit" class="button" value="<?php
if ( $images_total < 3 ) {
   echo "_UPLOAD_SUBMIT";
{
else {

echo "You have reached your upload limit";
   }

   {
   }
   ?>" /></td>
         </tr>

Thanks for the reply,

the $images_total < 3 was more of a typo than a problem, my problem is that either test message is still a submit button, I have attached pics of both results. I would like to only display a submit button if the upload limit is not reached.

 

[attachment deleted by admin]

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.