Jump to content

alfa

New Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

alfa's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, New to web hosting and wondered if anyone could recommend a good reciprocal link manager script please? I have been researching this on the web and found a couple that seem almost what I want which are; LinkMan http://www.phpjunkyard.com/php-link-manager.php unfortunately this doesn't include categories Link Station Pro http://www.linkstationpro.com/index.php unfortunately this doesn't include a way to highlight specific links like making them sponsored. Appreciate any feedback from anyone who has already done this leg work and found something that works well for them.. Kind regards Justin
  2. Hi Thanks for the replies, I found the issue was with the second form posting to itself through the form action = "". As the values had been parsed to form2 with curl the url was still showing the url of the first form. Therefore when I changed the action of the 2nd form to explicitly state itself rather than just "" this solved the problem. Cheers
  3. Hi all, I am new to PHP and have been struggling for a while to figure out a multi screen form. I have created two pages as it was rather cluttered on one. I found a lovely script for handling form validation server side but this showed posting the form back to itself. http://www.html-form-guide.com/php-form/php-form-validation.html That gave me the issue of then how to submit the values if they passed validation. I am also using a recaptcha which adds to the complexity. When I had things on a single page, if things passed validation, I called a form process script which then validated the recaptcha first and if this passed then I used curl to post my form values onto a form in PHPList (this is an open source mailing list, but its form handling didnt suit me). Now that I have split the form across two pages, the first appears to be working, although now when it passes validation I am using curl to get values to my second form. I am current starting a session on page2 as I thought that would be more appropriate as some people may browse to page1 but not want to complete registration. Upon posting page1 successfully, I note that the url in the address bar does't change, although the second form is now displayed. However, when I post the second form with errors it returns me to the first page rather than showing the errors on the second form even though the post action on the second form is also "". I would be very grateful for anyones guidance on this please. 1st form: (the html and form actually follows this code) <?PHP $show_form=true; $validatorerrorflag="0"; if(isset($_POST['Submit'])) { require_once "php-form-validator/formvalidator.php"; $validator = new FormValidator(); $validator->addValidation("attribute1","req","<b>first name</b> is a required field."); $validator->addValidation("attribute1","alpha","<b>first name</b> should be an alpha entry, without spaces."); $validator->addValidation("attribute1","maxlen=20","<b>first name</b> has a max input of 20 characters."); $validator->addValidation("attribute1","minlen=2","<b>first name</b> has a min input of 2 characters."); $validator->addValidation("attribute2","req","<b>last name</b> is a required field."); $validator->addValidation("attribute2","alpha","<b>last name</b> should be an alpha entry, without spaces."); $validator->addValidation("attribute2","maxlen=20","<b>last name</b> has a max input of 20 characters."); $validator->addValidation("attribute2","minlen=2","<b>last name</b> has a min input of 2 characters."); $validator->addValidation("attribute3","req","<b>recruitment agency?</b> is a required field."); $validator->addValidation("attribute4","req","<b>company name</b> is a required field."); $validator->addValidation("attribute4","alnum_s","<b>company name</b> should be an alpha and/or numeric input."); $validator->addValidation("attribute4","maxlen=40","<b>company name</b> has a max input of 40 characters."); $validator->addValidation("attribute5","num","<b>landline tel: dial code</b> should be a numeric entry."); $validator->addValidation("attribute5","maxlen=10","<b>landline tel: dial code</b> has a max input of 10 characters."); $validator->addValidation("attribute6","num","<b>landline tel: number</b> should be a numeric entry."); $validator->addValidation("attribute6","maxlen=10","<b>landline tel: number</b> has a max input of 10 characters."); $validator->addValidation("attribute7","num","<b>landline tel: ext</b> should be a numeric entry."); $validator->addValidation("attribute7","maxlen=5","<b>landline tel: ext</b> has a max input of 5 characters."); $validator->addValidation("attribute9","alnum","<b>2nd tel: type other?</b> should be an alpha and/or numeric input."); $validator->addValidation("attribute9","maxlen=10","<b>2nd tel: type other?</b> has a max input of 10 characters."); $validator->addValidation("attribute10","num","<b>2nd tel: dial code</b> should be a numeric entry."); $validator->addValidation("attribute10","maxlen=10","<b>2nd tel: dial code</b> has a max input of 10 characters."); $validator->addValidation("attribute11","num","<b>2nd tel: number</b> should be a numeric entry."); $validator->addValidation("attribute11","maxlen=10","<b>2nd tel: number</b> has a max input of 10 characters."); $validator->addValidation("attribute12","num","<b>2nd tel: ext</b> should be a numeric entry."); $validator->addValidation("attribute12","maxlen=5","<b>2nd tel: ext</b> has a max input of 5 characters."); if($validator->ValidateForm()) { $show_form=false; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, 'http://www.mydomain.co.uk/newsletter2.php'); // set the post-to url curl_setopt ($ch, CURLOPT_HEADER, false); // Header control $formfields = array('attribute1' => $_POST['attribute1'], 'attribute2' => $_POST['attribute2'], 'attribute3' => $_POST['attribute3'], 'attribute4' => $_POST['attribute4'], 'attribute5' => $_POST['attribute5'], 'attribute6' => $_POST['attribute6'], 'attribute7' => $_POST['attribute7'], 'attribute8' => $_POST['attribute8'], 'attribute9' => $_POST['attribute9'], 'attribute10' => $_POST['attribute10'], 'attribute11' => $_POST['attribute11'], 'attribute12' => $_POST['attribute12']); curl_setopt ($ch, CURLOPT_POST, 1); // tell it to make a POST, not a GET curl_setopt ($ch, CURLOPT_POSTFIELDS, $formfields); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); $response = curl_exec($ch); curl_close ($ch); } else { $error_hash = $validator->GetErrors(); $validatorerrorflag="1"; } } if(true == $show_form) { ?> If the validation fails then I use the validatorerrorflag in php blocks of code within the html form so that i can write out errors next to the corresponding fields. 2nd form: <?PHP session_start(); //now, let's register our session variables session_register('attribute1'); session_register('attribute2'); session_register('attribute3'); session_register('attribute4'); session_register('attribute5'); session_register('attribute6'); session_register('attribute7'); session_register('attribute8'); session_register('attribute9'); session_register('attribute10'); session_register('attribute11'); session_register('attribute12'); $_SESSION['attribute1']=Trim(stripslashes($_POST['attribute1'])); $_SESSION['attribute2']=Trim(stripslashes($_POST['attribute2'])); $_SESSION['attribute3']=Trim(stripslashes($_POST['attribute3'])); $_SESSION['attribute4']=Trim(stripslashes($_POST['attribute4'])); $_SESSION['attribute5']=Trim(stripslashes($_POST['attribute5'])); $_SESSION['attribute6']=Trim(stripslashes($_POST['attribute6'])); $_SESSION['attribute7']=Trim(stripslashes($_POST['attribute7'])); $_SESSION['attribute8']=Trim(stripslashes($_POST['attribute8'])); $_SESSION['attribute9']=Trim(stripslashes($_POST['attribute9'])); $_SESSION['attribute10']=Trim(stripslashes($_POST['attribute10'])); $_SESSION['attribute11']=Trim(stripslashes($_POST['attribute11'])); $_SESSION['attribute12']=Trim(stripslashes($_POST['attribute12'])); $show_form2=true; $validatorerrorflag="0"; if(isset($_POST['Submit2'])) { if(ereg( "[\r\n]", $_POST['email']) || ereg( "[\r\n]", $_POST['emailconfirm']) || ereg( "[\r\n]", $_POST['htmlemail']) || ereg( "[\r\n]", $_POST['password']) || ereg( "[\r\n]", $_POST['password_check'])){ print "<meta http-equiv=\"refresh\" content=\"0;URL=newsletter2.php\">"; exit; } require_once "php-form-validator/formvalidator.php"; $validator = new FormValidator(); $validator->addValidation("email","req","<b>email</b> is a required field."); $validator->addValidation("email","email","<b>email</b> should be a valid email value."); $validator->addValidation("emailconfirm","req","<b>confirm email</b> is a required field."); $validator->addValidation("emailconfirm","email","<b>confirm email</b> should be a valid email value."); $validator->addValidation("emailconfirm","eqelmnt=email","<b>email</b> & <b>confirm email</b> should be the same."); $validator->addValidation("htmlemail","req","<b>preferred format</b> is a required field."); $validator->addValidation("password","req","<b>password</b> is a required field."); $validator->addValidation("password","minlen=8","<b>password</b> has a min input of 8 characters."); $validator->addValidation("password","maxlen=12","<b>password</b> has a max input of 12 characters."); $validator->addValidation("password_check","req","<b>confirm password</b> is a required field."); $validator->addValidation("password_check","minlen=8","<b>confirm password</b> has a min input of 8 characters."); $validator->addValidation("password_check","maxlen=12","<b>confirm password</b> has a max input of 12 characters."); $validator->addValidation("password_check","eqelmnt=password","<b>password</b> & <b>confirm password</b> should be the same."); if($validator->ValidateForm()) { $show_form2=false; require_once "processsubscribe.php"; } else { $error_hash = $validator->GetErrors(); $validatorerrorflag="1"; } } if(true == $show_form2) { ?>
×
×
  • 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.