Advance thanx to all, i am having problem with my multistep form when validations happened. please help/suggest any ideas to solve it.

image uploaded properly with condition but do not show messages and then go next step

    $filename = $_FILES['photo']['name'];
    // get extension of the image
    $ext = strtolower(substr(strrchr($filename, '.'), 1));
    $img_name = $uname . '.' . $ext;
    // image upload directory
    $target_path = "uploads\\";
    $target_path = $target_path . $img_name;
    // extensions which are allowed to upload
    $wing = array('image/pjpeg', 'image/jpeg', 'image/jpg', 'image/png', 'image/gif');
    // validate image before upload
    if ((in_array($_FILES['photo']['type'], $wing)))
    {
        if ($_FILES['photo']['size']<204800)
        {
            if(move_uploaded_file($_FILES['photo']['tmp_name'], $target_path)){}
        }
        else
        {
            $error = "Maximum file size limits is crossed !!!";
        }
    }
    else
    {
        $error = "These file extensions are not allowed !!!";
    }

form submitted and go next step without showing error message.

    <?php
    if ( isset( $_POST["step"] ) and $_POST["step"] >= 1 and $_POST["step"]<= 5 ) 
    {
        call_user_func( "processStep" . (int)$_POST["step"] );
    } 
    else 
    {
        displayStep1();
    }

    function processStep1() 
    {
        displayStep2();
    }
    function processStep2() 
    {
        if ( isset( $_POST["complete"] ) and $_POST["complete"] =="< Back" ) 
        {
            displayStep1();
        } 
        else 
        {
            displayStep3();
        }
    }

below is my form

    <?php function displayStep1() { ?>


    <form id="add_info" action="" method="post" enctype="multipart/form-data">

     <!-- value devlivered from step to condition -->
     <input type="hidden" name="step" value="4" />

     <div class="wizard">
      <h3 id="repost">Step 1</h3>
      <h3>Step 2</h3>
      <h3>Step 3</h3>
      <h3 class="active">Step 4</h3>
     </div>

     <ul>
      <?php if(!empty($success)) { ?>
      <li class="suc-notice"><?php echo $success; ?></li>
      <?php } ?>
      <?php if(!empty($error)) { ?>
      <li class="err-notice"><?php echo $error; ?></li>
      <?php } ?>         
     </ul>

     <div class="picUpload">
      <span class="fileWrapper">
       <input type="file" name="photo" id="photo" />
       <span class="btnSelect">Select A Photo</span>
      </span>
     </div>

     <ul>
      <li class="form_head">Form Submission</li>
      <li class="check-cont">
       <input type="checkbox" name="checkbox" id="checkbox" class="checkbox" cheked="checked" value="0" onClick="showHide(document.getElementById('disable'));"/>
       <label id="chk_label">Please, Check this box to complete the process.</label>      
      </li>
      <li class="end-list" id="disable" style="visibility: hidden">
        <button type="submit" name="complete" id="complete">Submit</button>
      </li>
     </ul>
    </form>

    <?php } ?>

First try to debug it (module by module so you can disable all the functions and test only one). furthermore, note that you can rely on the $_FILES array to check the image type and you don't need to use steps in the code starting from the line 2 to extract the image type. you can use $_FILES[filename][type], assign this value to a variable and then compare it with the MIME type of the images (you already use them in the line 9 of your code).
Try to test it as I told you and lets keep in touch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.