ساخت فرم ثبت فیش بانکی ؟

jafar1374

کاربر عضو
سلام دوستان - خسته نباشید

می خوام یه فرم ثبت فیش بانکی درست کنم اما هی ارور می زنه و کلافم کرده :(

می خواستم ببینم دوستان امادشو دارن ؟ :109:

ممنون :57:

 

Mohammad

مدیر انجمن
پرسنل مدیریت
فیلد های مورد نیاز شما چیه؟خطا رو ذکر کنید کمک کنیم. اینطوری یاد میگیرید...

 

jafar1374

کاربر عضو
فیلد های مورد نیاز شما چیه؟خطا رو ذکر کنید کمک کنیم. اینطوری یاد میگیرید...
وقتی فیلدی رو می سازم و جاش رو خالی می ذارم باید خطا بده که مثلا فلان چیز رو وارد کنید اما اون خطا رو نشون نمی ده

مرحله اول همینه تا به مراحل بعدی هم برسم باز ایراد داشتم می پرسم

البته دارم از یه فرم تماس با ما استفاده می کنم

اگه لازمه کد کاملش رو بذارم !

 

agahassan

کاربر عضو
برای چیزی که گفتی با یه جاوا ساده میشه . اینم نمونه


کد:
<form  action="#" method="post" onsubmit="return checkform(this);">

    <p>
      <input type="text" name="txtInput" id="txtInput" size="30" />
    </p>



    <button type="submit">ارسال</button>

</form>
<script type="text/javascript">
    function checkform(theform){
        var why = "";

        if(theform.txtInput.value == ""){
            why += "باکس خالی است";
        }
            if(why != ""){
            alert(why);
            return false;
        }
    }

</script>
</body>
 

Mohammad

مدیر انجمن
پرسنل مدیریت
یا با php میتونی بزنی

if (isset (($value =="" & value2==""))

$error = "takmil konid";

else form ok...

کلی گفتم. با موبایل اومدم ببخشید. کدتون رو بزارید اینجا تا ببینیم خطا چیه

از فرم ولیدیتور ها هم میتونی استفاده کنی....

 

jafar1374

کاربر عضو
برای چیزی که گفتی با یه جاوا ساده میشه . اینم نمونه

کد:
<form  action="#" method="post" onsubmit="return checkform(this);">

    <p>
      <input type="text" name="txtInput" id="txtInput" size="30" />
    </p>



    <button type="submit">ارسال</button>

</form>
<script type="text/javascript">
    function checkform(theform){
        var why = "";

        if(theform.txtInput.value == ""){
            why += "باکس خالی است";
        }
            if(why != ""){
            alert(why);
            return false;
        }
    }

</script>
</body>
یه فرم تماس با ما دارم ک پی اچه می خوام از رو همون بسازم

یا با php میتونی بزنیif (isset (($value =="" & value2==""))

$error = "takmil konid";

else form ok...

کلی گفتم. با موبایل اومدم ببخشید. کدتون رو بزارید اینجا تا ببینیم خطا چیه

از فرم ولیدیتور ها هم میتونی استفاده کنی....
محمد این فرم تماس با هستش که من ازش استفاده می کنم مثل همین فیلد اضافه می کنم وقتی که باکس خالیه خطایی نمی زنه !

این خط رو ببینید بی زحمت ...


کد:
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
هر فیلد اضافه ای ک می زنیم اینجا هم باید چیزی اضافه بشه ؟

اینم فرم تماس با ما منه


کد:
<?php
/*
Template Name: Contact Form
*/
?>

<?php 
//If the form is submitted
if(isset($_POST['submitted'])) {

    //Check to see if the honeypot captcha field was filled in
    if(trim($_POST['checking']) !== '') {
        $captchaError = true;
    } else {

        //Check to make sure that the name field is not empty
        if(trim($_POST['contactName']) === '') {
            $nameError = 'لطفا نام خود را وارد نمایید.';
            $hasError = true;
        } else {
            $name = trim($_POST['contactName']);
        }

        //Check to make sure sure that a valid email address is submitted
        if(trim($_POST['email']) === '')  {
            $emailError = 'لطفا ایمیل خود را وارد نمایید.';
            $hasError = true;
        } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
            $emailError = 'ایمیل وارد شده معتبر نمی باشد.';
            $hasError = true;
        } else {
            $email = trim($_POST['email']);
        }

        //Check to make sure comments were entered    
        if(trim($_POST['comments']) === '') {
            $commentError = 'گویا پیام خود را فراموش کرده اید..';
            $hasError = true;
        } else {
            if(function_exists('stripslashes')) {
                $comments = stripslashes(trim($_POST['comments']));
            } else {
                $comments = trim($_POST['comments']);
            }
        }

        //If there is no error, send the email
        if(!isset($hasError)) {

            $emailTo = 'jafar_1374@yahoo.com';
            $subject = 'Contact Form Submission from '.$name;
            $sendCopy = trim($_POST['sendCopy']);
            $body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
            $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

            mail($emailTo, $subject, $body, $headers);

            if($sendCopy == true) {
                $subject = 'You emailed Your Name';
                $headers = 'From: Your Name <noreply@somedomain.com>';
                mail($email, $subject, $body, $headers);
            }

            $emailSent = true;

        }
    }
} ?>

<?php get_header(); ?>


<body>
<div id="main">
  <div id="contentpost">




<?php if(isset($emailSent) && $emailSent == true) { ?>

    <div class="thanks">
        <h1>سپاس , <?=$name;?></h1>
        <p>پیام شما با موفقیت فرستاده شد. در صورت امکان به زودی پاسخ داده خواهد شد.</p>
    </div>

<?php } else { ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class="content">
      <div class="content-detail">
      در این صفحه شما می توانید هر پیامی که دارید برای ما بفرستید ! در اولین فرصت به شما پاسخ خواهیم داد.
      </div>
      <div class="content-title-contect">
        <h4><a href="<?php the_permalink() ?>">
          <?php the_title(); ?>
          </a></h4>
      </div>
      <div class="content-thumb">
        <?php the_post_thumbnail('medium'); ?>
      </div>
      <div class="content-article">
       <?php the_content(); ?>
       <?php if(isset($hasError) || isset($captchaError)) { ?>
            <p class="error">ایرادی در فرستادن پیام دیده شده ! لطفا ایرادها را بررسی نمایید.<p>
        <?php } ?>
        <form action="<?php the_permalink(); ?>" id="contactForm" method="post">

            <ol class="forms">
                <li><label for="contactName">نام شما</label>
                    <input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField" />
                    <?php if($nameError != '') { ?>
                        <span class="error"><?=$nameError;?></span> 
                    <?php } ?>
                </li>

                <li><label for="email">ایمیل شما</label>
                    <input type="text" name="email" id="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email" />
                    <?php if($emailError != '') { ?>
                        <span class="error"><?=$emailError;?></span>
                    <?php } ?>
                </li>

                <li class="textarea"><label for="commentsText">پیام</label>
                    <textarea name="comments" id="commentsText" rows="20" cols="30" class="requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
                    <?php if($commentError != '') { ?>
                        <span class="error"><?=$commentError;?></span> 
                    <?php } ?>
                </li>
                <li class="inline"><input type="checkbox" name="sendCopy" id="sendCopy" value="true"<?php if(isset($_POST['sendCopy']) && $_POST['sendCopy'] == true) echo ' checked="checked"'; ?> /><label for="sendCopy">یک رونوشت از این پیام را به ایمیلم بفرست.</label></li>
                <li class="screenReader"><label for="checking" class="screenReader">If you want to submit this form, do not enter anything in this field</label><input type="text" name="checking" id="checking" class="screenReader" value="<?php if(isset($_POST['checking']))  echo $_POST['checking'];?>" /></li>
                <li class="buttons"><input type="hidden" name="submitted" id="submitted" value="true" /><button type="submit">فرستادن پیام »</button></li>
            </ol>
        </form>
      </div>

    </div>


    <?php endwhile; ?>
    <?php endif; ?>
<?php } ?>

  </div>
  <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
</body>
اینم فایل جاواش :


کد:
$(document).ready(function() {
    $('form#contactForm').submit(function() {
        $('form#contactForm .error').remove();
        var hasError = false;
        $('.requiredField').each(function() {
            if(jQuery.trim($(this).val()) == '') {
                var labelText = $(this).prev('label').text();
                $(this).parent().append('<span class="error">You forgot to enter your '+labelText+'.</span>');
                hasError = true;
            } else if($(this).hasClass('email')) {
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                if(!emailReg.test(jQuery.trim($(this).val()))) {
                    var labelText = $(this).prev('label').text();
                    $(this).parent().append('<span class="error">You entered an invalid '+labelText+'.</span>');
                    hasError = true;
                }
            }
        });
        if(!hasError) {
            $('form#contactForm li.buttons button').fadeOut('normal', function() {
                $(this).parent().append('<img src="/wp-content/themes/patomatlovers/images/loading.gif" alt="Loading…" height="19" width="220" />');
            });
            var formInput = $(this).serialize();
            $.post($(this).attr('action'),formInput, function(data){
                $('form#contactForm').slideUp("fast", function() {                   
                    $(this).before('<p class="thanks"><strong>Thanks!</strong> Your email was successfully sent. I check my email all the time, so I should be in touch soon.</p>');
                });
            });
        }

        return false;

    });
});
 
بالا