how do i change the content of a div using php

It doesn’t exactly have to be a div, it can be anything, a article section a …

I’m making a website for a university project, the website is similar to DropBox (file hosting website). NON COMMERCIAL!

I’m on the registration page at the moment and what I want to do is after the user presses the submit button I want to change the content of a div tag which is next to the field which is wrongly entered.

For example, if the user types in a password that is less than 3 characters long an “X” will appear in the div tag next to the password field and under the submit button a message will appear saying “Password must be more than 3 characters.”

This is part of the code, not posting all of it because it’s too long.

<form action="register.php" method="post" >
  <section>
    <article>Password*</article>
    <input type="text" name="password" id="password" required="required"/>
    
<!-- tick - ✓ , wrong - X --> </section> <input type="submit" name="register" value="Register" />
</form>

I have tried to search on how to do this but I can’t find anything and I just can’t figure it out.

I know I can put the PHP code in the div tag and assess it from there but I want to put the code at the bottom of the form to make it neater.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s