Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:50:24+00:00 2026-06-14T05:50:24+00:00

EDIT/UPDATE: I moved my php code from my process.php file to the top of

  • 0

EDIT/UPDATE:

I moved my php code from my process.php file to the top of my contact.php file and it worked. So what am I missing from the process.php file that is not redirecting it back to the contact.php page?

This is my html in contact.php

<?php echo $message; ?>    
<form action="process.php" method="post" name="sign_up">
                                <input type="text" name="first_name" placeholder="First Name" value="<?php echo $_POST[first_name]; ?>" required/>
                                <input type="text" name="last_name" placeholder="Last Name" value="<?php echo $_POST[last_name]; ?>" required/><br>
                            <label class="bill-address">Billing Address:<br>
                                <input type="text" name="address1" placeholder="Address 1" value="<?php echo $_POST[address1]; ?>" required/><br>
                                <input type="text" name="address2" placeholder="Address 2" value="<?php echo $_POST[address2]; ?>" /><br>
                                <input type="text" name="city" placeholder="City" value="<?php echo $_POST[city]; ?>" required/>
                            </label>
                            <?php  
                             $state_list = array('AL'=>"Alabama",  
                                        'AK'=>"Alaska",  
                                        'AZ'=>"Arizona",  
                                        'AR'=>"Arkansas",  
                                        'WV'=>"West Virginia",  
                                        'WI'=>"Wisconsin",  
                                        'WY'=>"Wyoming");
                            ?>
                            <select name="state">
                            <?php
                                while(list($k,$v) = each($state_list)) {
                                    $selected = '';
                                    if ($k == $_POST[state]) {
                                        $selected = ' selected="true"';
                                    }
                                echo "<option value=\"$k\"$selected>$v</option>\n";
                                } 
                            ?>
                            </select>
            <input type="text" name="zip" placeholder="Zip Code" value="<?php echo $_POST[zip]; ?>" required/>
            <br style="clear: left;" />
            <input type="email" name="email" placeholder="you@youremail.com" value="<?php echo $_POST[email]; ?>" required/>
            <input type="tel" name="phone" placeholder="Phone" value="<?php echo $_POST[phone]; ?>" required/>
    <h3>Choose your Package</h3>
        <select name="package">
            <option value="Free">Free!</option>
            <option value="Basic">Basic</option>
            <option value="Corporate">Corporate</option>
            <option value="Enterprise">Enterprise</option>
            <option value="Enterprise_20">Enterprise 20</option>
            <option value="Enterprise_50">Enterprise 50</option>
            <option value="Enterprise_100">Enterprise 100</option>
        </select>
    <h3>Add Media Package?</h3>
            <input type="radio" name="Yes" value="yes" />Yes
            <input type="radio" name="No" value="no" />No
    <button type="submit" class="btn">Send &raquo;</button>
    <?php echo $success_message; ?>
</form>

And this is my process.php

    //validate email
function is_valid_email($email) {

        $result = true;
        $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i';
        if(!preg_match($pattern, $email)) {
            $result = false;
        }
        return $result;
    }

//when submit has been pressed, begin form validate
if(isset($_POST['submit'])) {

    $valid = true;
    $message = '';
    if ( $_POST['first_name'] == "" ) {
        $message .= "Please include your first name. ";
        $valid = false; 
    }
    if ( $_POST['last_name'] == "" ) {
        $message .= "Please include your last name. ";
        $valid = false; 
    }
    if ( $_POST['address1'] == "" ) {
        $message .= "Please include your billing address. ";
        $valid = false; 
    }
    if ( $_POST['city'] == "" ) {
        $message .= "Please enter a city. ";
        $valid = false; 
    }
    if ( $_POST['state'] == "" ) {
        $message .= "Please select a state. ";
        $valid = false; 
    }
    if ( $_POST['zip'] == "" ) {
        $message .= "Please include a zip code. ";
        $valid = false; 
    }
    if ( $_POST['phone'] == "" ) {
        $message .= "Please include your phone number. ";
        $valid = false; 
    }
    if ( !is_valid_email($_POST['email']) ) {
        $message .= "A valid email is required. "; 
        $valid = false; 
    }
    if ( $_POST['package'] == "" ) {
        $message .= "You forgot to select a service package. ";
        $valid = false; 
    }

    if ( $valid == true ) {
        $success_message = 'Brilliant I say! We will be in contact with you shortly.';

        //clear form when submission is successful
        unset($_POST);
    }
}

It is not working. Also the html5 validation isn’t even working either. Is there something wrong with my form markup?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:50:26+00:00Added an answer on June 14, 2026 at 5:50 am

    When you click on submit, your browser navigates to process.php. All of the code from contact.php is forgotten and a new page is generated.

    There is no implied link between the two pages. The messages from process.php will not apppear on contact.php. Currently, process.php doesn’t echo anything, so you’re probably arriving at a blank page.

    An alternate way to do this would be to merge the two pages like this:

    <?php
        //validate email
    function is_valid_email($email) {
    
            $result = true;
            $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i';
            if(!preg_match($pattern, $email)) {
                $result = false;
            }
            return $result;
        }
    
    //when submit has been pressed, begin form validate
    if(isset($_POST['submit'])) {
    
        $valid = true;
        $message = '';
        if ( $_POST['first_name'] == "" ) {
            $message .= "Please include your first name. ";
            $valid = false; 
        }
        if ( $_POST['last_name'] == "" ) {
            $message .= "Please include your last name. ";
            $valid = false; 
        }
        if ( $_POST['address1'] == "" ) {
            $message .= "Please include your billing address. ";
            $valid = false; 
        }
        if ( $_POST['city'] == "" ) {
            $message .= "Please enter a city. ";
            $valid = false; 
        }
        if ( $_POST['state'] == "" ) {
            $message .= "Please select a state. ";
            $valid = false; 
        }
        if ( $_POST['zip'] == "" ) {
            $message .= "Please include a zip code. ";
            $valid = false; 
        }
        if ( $_POST['phone'] == "" ) {
            $message .= "Please include your phone number. ";
            $valid = false; 
        }
        if ( !is_valid_email($_POST['email']) ) {
            $message .= "A valid email is required. "; 
            $valid = false; 
        }
        if ( $_POST['package'] == "" ) {
            $message .= "You forgot to select a service package. ";
            $valid = false; 
        }
    
        if ( $valid == true ) {
            $success_message = 'Brilliant I say! We will be in contact with you shortly.';
    
            //clear form when submission is successful
                              //don't clear this, you need this to re-populate the page below
            //unset($_POST);
        }
    }
    
    ?><!doctype html>
    <html>
    <head>
    ...
    </head>
    <body>
    <?php echo $message; ?>    
    <form action="contact.php" method="post" name="sign_up">
        <input type="text" name="first_name" placeholder="First Name" value="<?php echo $_POST[first_name]; ?>" required/>
        <input type="text" name="last_name" placeholder="Last Name" value="<?php echo $_POST[last_name]; ?>" required/><br>
        <label class="bill-address">Billing Address:<br>
            <input type="text" name="address1" placeholder="Address 1" value="<?php echo $_POST[address1]; ?>" required/><br>
            <input type="text" name="address2" placeholder="Address 2" value="<?php echo $_POST[address2]; ?>" /><br>
            <input type="text" name="city" placeholder="City" value="<?php echo $_POST[city]; ?>" required/>
        </label>
    <?php  
    $state_list = array('AL'=>"Alabama",  
                                            'AK'=>"Alaska",  
                                            'AZ'=>"Arizona",  
                                            'AR'=>"Arkansas",  
                                            'WV'=>"West Virginia",  
                                            'WI'=>"Wisconsin",  
                                            'WY'=>"Wyoming");
                                ?>
                                <select name="state">
                                <?php
                                    while(list($k,$v) = each($state_list)) {
                                        $selected = '';
                                        if ($k == $_POST[state]) {
                                            $selected = ' selected="true"';
                                        }
                                    echo "<option value=\"$k\"$selected>$v</option>\n";
                                    } 
                                ?>
                                </select>
                <input type="text" name="zip" placeholder="Zip Code" value="<?php echo $_POST[zip]; ?>" required/>
                <br style="clear: left;" />
                <input type="email" name="email" placeholder="you@youremail.com" value="<?php echo $_POST[email]; ?>" required/>
                <input type="tel" name="phone" placeholder="Phone" value="<?php echo $_POST[phone]; ?>" required/>
        <h3>Choose your Package</h3>
            <select name="package">
                <option value="Free">Free!</option>
                <option value="Basic">Basic</option>
                <option value="Corporate">Corporate</option>
                <option value="Enterprise">Enterprise</option>
                <option value="Enterprise_20">Enterprise 20</option>
                <option value="Enterprise_50">Enterprise 50</option>
                <option value="Enterprise_100">Enterprise 100</option>
            </select>
        <h3>Add Media Package?</h3>
                <input type="radio" name="Yes" value="yes" />Yes
                <input type="radio" name="No" value="no" />No
        <button type="submit" class="btn">Send &raquo;</button>
        <?php echo $success_message; ?>
    </form>
    </body>
    </html>
    

    The $message and $success_message variables are now saved and they should display in the page markup below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit : Moved the actual question to the top. Update : Found an example
Dynamically I want to edit/update hosts(etc/hosts) file to add domain. To edit hosts(etc/hosts) file
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
I use JEditable for making edit field which following code: $(function() { $(.field).editable(http://localhost/index.php/welcome/update_record, {
With a CMS (PHP/MySQL) that's getting bigger and bigger and its code harder to
Is it possible to edit and update a GridView cell without using <asp:TemplateField> and/or
i am using devexpress grid with edit functioality to update the records in the
EDIT My Ajax form gets correct Id to update a content and a replace
def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
-edit- nevermind, i made a mistake in my select statement. Update was working correctly.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.