Page forms disappear

This is where you share YOUR scripts with others

Moderators: egami, macek, gesf

Post Reply
User avatar
Strider64
php-forum Active User
php-forum Active User
Posts: 314
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Sat Feb 13, 2016 4:45 am

Nope, but intermingling HTML and PHP, plus using inline JavaScript and no formatting (The major problem) of the code is confusing as can be. :o

I just got a headache looking at the code. :(
Sorry for being so blunt, but in my opinion it is always best to be honest.

User avatar
Strider64
php-forum Active User
php-forum Active User
Posts: 314
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI
Contact:

Sat Feb 13, 2016 4:55 am

Here are a few examples that will give you an idea what I'm trying to say

Code: Select all

<form id="registerPage" action="registerPage.php" method="post">
    <fieldset>
        <legend>Registration Form</legend>
        <label for="username">username</label>
        <input id="username" type="text" name="data[username]" value="<?php echo (isset($data) && $status['duplicate']) ? $data['username'] : NULL; ?>">
        <label>password</label>
        <input type="password" name="data[password]">
        <label>confirm password</label>
        <input type="password" name="data[verify]">
        <label>first name</label>
        <input type="text" name="data[first_name]" value="<?php echo (isset($data['first_name']) && $data['first_name']) ? $data['first_name'] : NULL; ?>">
        <label>last name</label>
        <input type="text" name="data[last_name]" value="<?php echo (isset($data['last_name']) && $data['last_name']) ? $data['last_name'] : NULL; ?>">
        <label>email address</label>
        <input type="text" name="data[emailAddress]" value="<?php echo (isset($data['emailAddress']) && $status['validEmail']) ? $data['emailAddress'] : NULL; ?>">
        <input type="submit" name="submit" value="register">
    </fieldset>
</form>

Code: Select all

    <form id="contact" action="<?php echo $basename; ?>" method="post">
        <fieldset>
            <legend><?php echo isset($success) ? $success : 'Contact Form'; ?></legend>
            <label for="first_name">First Name</label>
            <input id="first_name" type="text" name="first_name" value="">
            <label for="last_name">Last Name</label>
            <input id="last_name" type="text" name="last_name" value="">
            <label for="email">Email Address</label>
            <input id="email" type="email" name="email" value="">
            <div id="subject">
                <label  for="subjectInput">Leave blank</label>
                <input type="text" name="subject" id="subjectInput" autocomplete="off">
            </div>
            <script>
                (function () {
                    var e = document.getElementById("subject");
                    e.parentNode.removeChild(e);
                })();
            </script>   
            <hr class="contactLine">
            <div class="radioBlock">
                <input type="radio" id="radio1" name="reason" value="message" checked>
                <label class="radioStyle" for="radio1">comment</label>
                <input type="radio" id="radio2" name="reason" value="price">
                <label class="radioStyle" for="radio2">pricing</label>  
                <input type="radio" id="radio3" name="reason" value="order">
                <label class="radioStyle" for="radio3">order info</label>    
            </div>

            <label class="textareaLabel" for="message">Message</label>
            <textarea id="message" name="comment" placeholder="Enter message here..."></textarea>
            <input type="submit" name="submit" value="submit">
        </fieldset>
    </form> 
Yeah, I know there's PHP and JavaScript intermingle, but sometimes it's unavoidable and that might be the case with your form. However, it's hard to tell with no formatting going on.

User avatar
j4012345
New php-forum User
New php-forum User
Posts: 21
Joined: Sun Feb 14, 2016 10:57 am

Sun Feb 14, 2016 1:31 pm

Do you have any javascript link attached in header?

Post Reply