Jump to content

Recommended Posts

I'm doing a slight modification of the punbb bulletin board software. Specifically I've added a required edit field (called 'tag') to the registration page. Well, when the information if filled out properly, there is no problem.

 

I have the script set up to catch anyone who leaves the tag empty. The user is prompted to use the Go Back link or hit the back button. BUT...when they fill out the tag field and hit the Submit button, the field is still being shown as empty.

 

Is there something generic I'm overlooking...or should I post the code?

 

 

 

 

 

 

 

 

Just to clear exactly what happens:

The 'onsubmit' javascript is disabled in this functionality for some reason (otherwise it gives an popup prompting to fill in the fields).

The tags are passed as an array and processed,  ie one may submit more than one tag in the field.

The 'message' function terminates the process and outputs that message immediately in html. It also includes the javascript link to Go Back

Again, this works ok if it's done right the first time; it's when you hit the back button etc...

 

register.php
if (!isset($_POST['form_sent']))
{
   <form id="register" method="post" action="register.php?action=register" 
    onsubmit="this.register.disabled=true;if(process_form(this)){return true;}else{this.register.disabled=false;return false;}">

        <input type="hidden" name="form_sent" value="1" />
<label>'Username'</label><br />
<input type="text" name="req_username" size="25" maxlength="25" /><br /></label>

         <label>'Tags'</label><br />
         <input type="text" name="req_arr_tags" size="40" maxlength="200" /><br /></label>

         <input type="submit" name="register" value="Register" />
}
if (isset($_POST['form_sent']))
{
   if (strlen($username) < 2)
message('Username too short');
}

else if($arr_tags = 1)
{	
   $arr_tags = $_POST['req_arr_tags'];
   
   if($arr_tags == '')
   {
      message('You must enter at least one tag so others can connect to you.');
   }
}
//otherwise enter the username and tags into the database

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.