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 } ?>