andyhunter -1 Newbie Poster

sorry i did have googles one but it would not work. I was using the php plugin but the javascript one loads i just can work out how to validate it before sending ?

actual sending of input

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta name="viewport" content="initial-scale=1, maximum-scale=1" />

<meta name="viewport" content="width=device-width" />

<title>Emailing sending to myself</title>



</head>



</head>



<body>



<?php

    // Your code here to handle a successful verification 

    $email_to = "somewhere@email.com";

    $name = $_POST["name"];

    $email = $_POST["email"];

    $url = $_POST["url"];

    $message = $_POST["message"];

    $text = "NAME: $name<br>

             EMAIL: $email<br>

             URL: $url<br>        

             MESSAGE: $message";

    $headers = "MIME-Version: 1.0" . "\r\n"; 

    $headers .= "Content-type:text/html; charset=utf-8" . "\r\n"; 

    $headers .= "From: <$email>" . "\r\n";

    mail($email_to, "Message", $text, $headers);

?>

</body>

</html>

the code for input

<form action="send.php" id="contact-form" class="form" method="post">
            <ul> 
                <li>
                    <p><strong>Name</strong> <em>(*)</em></p>
                    <input name="name" type="text" class="requiredField" />
                </li>

                <li>
                    <p><strong>E-mail</strong> <em>(*)</em></p>
                    <input name="email" type="text" class="requiredField email" />       
                </li>

                <li>
                    <p><strong>URL</strong> <em>(Optional)</em></p>   
                    <input name="url" type="text" />
                </li>

                <li>
                    <p><strong>Message</strong> <em>(*)</em></p>
                    <textarea name="message" rows="20" cols="30" class="requiredField"></textarea>        
                </li>                
                <li class="submit-button">
                    <input class="submit" type="reset" name="reset" value="Reset"/>
                    <input name="submit" id="submitted" value="Send Message" class="submit" type="submit" />
                </li>
            </ul>

        </form><!--END CONTACT FORM-->

i placed both javascript and php plugin above submit.

andyhunter -1 Newbie Poster

how do you manually add it when the link is www.somesite.com which i would want it to be added to index.html ?

function setActive() {
/*current page function*/
 $('#menu a').each(function(index) {
        if(this.href.trim() == window.location)
            $(this).addClass("current");
    });

this works for any pages that are in the navigation menu.

andyhunter -1 Newbie Poster

I got the js to load but i can not figuer out how to verify without mail being passed through instead of caught out using googles example and watching you tube videos.

I am updating exisiting mail form that has validation on it.

I tried the php plugins but they wont even load, i understand the public and private key.

Really am puzzled by this if anyone would care to explain.

andyhunter -1 Newbie Poster

How do you have spaces in xml, it seems to stick spaces at the start and end but if you type and have spaces for words and or sentences it picks it up.

<record>
      <title xml:space="default"> 			My Terrible Friend 		</title>
			<author>The Pains of Being Pure At Heart</author>
			<mp3>sounds/ThePainsOfBeingPureAtHeart-MyTerribleFriend.mp3</mp3>
   </record>

which would show in scrolling title bar but spaces for title would be = my terrible friend, instead of = my terrible friend

am i missing something ?

andyhunter -1 Newbie Poster

thank you very much, i was about to give up.I did not know that could be used :O.

andyhunter -1 Newbie Poster

thanks for help. thought it would have been more complex

andyhunter -1 Newbie Poster

thats great but the problem is that i need it not to equal (Mr|Mrs|Miss){1} i.e. with characters [^m] but i dont think != works with this type of regex ?

andyhunter -1 Newbie Poster

trying to create a matcher for finding if title is not correct i.e. has to be mr, mrs, miss etc..but this allows mrmrmr etc when it should not. tried different setups to keep failing i.e. [[]] or ().

public void valTitle(){
    //validate title
    while (this.title.matches("^[\\s]+$")
                                    ||this.title.matches("")
                                    ||this.title.matches("[^m]&&[^r]*")
                                    ){
                                System.out.println("Title can not"
                                        + " be empty or have spaces, must contain "
                                        + "a-z characters and has to be correct "
                                        + "length in size i.e. Mr or Miss");
                                System.out.println("Enter your title ?");
                                 title = inputDetails.nextLine();
        }
    }
andyhunter -1 Newbie Poster
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/** name of the project which is scrubshospitalapp
 *
 */
package scrubshospitalapp;
/** required to get input from the keyboard
 *
 */

import java.util.Scanner;

/**
 *
 * @author hun10009554
 */
/** class called person
 *
 *
 */
//start of overall module
public class Person {
/** declaring private variables that are all type String for title, surname,
 * gender, contactnum, dob
 *
 */
    private String title;
    private String forename;
    private String surname;
    private String gender;
    private String contactNum;
    private String dob;

/** declare and initialise inputdetails from the scanner to get user input
 * from keyboard
 *
 */
    Scanner inputDetails = new Scanner (System.in);

/** creating default person
 * 
 */
    public Person(){
        
    }


    /**Method to display output to screen i.e. title, forename, surname, gender,
     * contact number, dob which inputs the revelant information in i.e. title,
     * forename, surname, gender, contact number, dob which equals already
     * declared and intial variables
     */
    public void createPerson(){

        System.out.println("Please enter your title ?");
        title = inputDetails.nextLine();
        this.valTitle();
        
        System.out.println("Please enter your forename ?");
        forename = inputDetails.nextLine();
        this.valForename();
        
        System.out.println("Please enter your surname ?");
        surname = inputDetails.nextLine();
        this.valSurname();
        
        System.out.println("Please enter your gender ?");
        gender = inputDetails.nextLine();
        this.valGender();
        
        System.out.println("Please enter your contact number ?");
        contactNum = inputDetails.nextLine();
        this.valContactNum();
        
        System.out.println("Please enter your date of birth ?");
        dob = inputDetails.nextLine();
        this.valDob();
    }
    
    /**method to validate the title to make sure it is only contains characters
     * if title is …
andyhunter -1 Newbie Poster

if items are added into an arraylist would another arraylist be required for grouping items or would a hashmap or something else be required i.e. title, firstname, last name etc saved indvidually but therefore grouped to equal person 1 and so on ? the reason for grouping is to edit the grouped items from the arraylist individually or all.

andyhunter -1 Newbie Poster

it produces a open/save window, no image in web browser if i run security_image.php but if i run the webpage then image does not load if that is any help. I can upload the other source codes if thats any help ? but could it be anything to do with i am running the page on the computer and not actual sever with the files being the server side code ?

andyhunter -1 Newbie Poster
<form name="contact_form" method="post" action="./contact/mailer.php" onSubmit="return evalid()">
<table border="0"><tr>
    <td>First Name *</td>
    <td colspan="2"><input name="fname" type="text" size="30" /></td>
  </tr><tr>
    <td>Last Name *</td>
    <td colspan="2"><input name="lname" type="text" size="30" /></td>
  </tr><tr>
    <td>Your E-mail *</td>
    <td colspan="2"><input type="text" name="mail" size="30" /></td>
  </tr><tr>
    <td>Phone</td>
    <td colspan="2"><input name="phone" type="text" size="30" onkeypress="return numere(event)" onkeyup="return limitarelungime(this, 12)"  /></td>
  </tr><tr>
    <td>Message Priority </td>
    <td colspan="2"><select name="mpriority">
      <option selected="selected">Normal</option>
      <option>Low</option>
      <option>High</option>
      <option>Urgent</option>
        </select>
    </td>
  </tr><tr>
    <td>Subject *</td>
    <td colspan="2"><input name="subject" type="text" size="30" /></td>
  </tr><tr>
    <td>Message *</td>
    <td colspan="2"><textarea name="message" onkeyup="return limitarelungime(this, 255)"  cols="35" rows="5"></textarea></td>
  </tr><tr>
       <td><p>Security Code*<br/>
           </p>
         </td>
       <td><input id="chapcha_code"  size="10" name="chapcha_code" type="text" /> </td>        
       <td><img src="./contact/security_image.php" border="0" /></td>
     </tr><tr>
    <td> </td>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td><input type="reset" name="reset" value="Reset"/></td>
    <td align="right"><input type="submit" name="Submit" value="Submit"></td><td align="right"><a href="http://www.scriptgenerator.net/71/HTML%7B47%7DPHP-Contact-Form-Mailer-Generator/" title="Valid Contact Form"><img src="http://www.scriptgenerator.net/images/validform.jpg" alt="Valid Contact Form" width="20" height="20" border="0" /></a></td>
  </tr>
</table>
</form>    

cannot get the captcha to load the image, am using my computer as a tempt webserver to preview as yet to get a web host.

also have contact.php, mailer.php, security_image.php but have linked them all together as best as what i know?[/

andyhunter -1 Newbie Poster

Stuck on trying to limit a persons name to say 20 characters in a string or a phone number to 6 characters in a string, i cant get the {} inside or after regex to work with either a minimium or maximium number so that in my loop if a persons name is over 20 chracters then it will continual loop or i.e. phone number is less than 6 or more than 6 chracters it will keep looping, any help would be great the internet does not have better explation for this stuff so any one that understands it would be doing me a huge favour to understand this complex stuff, thanks.. sample code would be

                    do{
                        /*if salesPersonName is null or just spaces then this
                          piece of code runs, displaus output and asks for input
                          which salespersoname = input 2
                        */
                        if (salesPersonName.matches("^[\\s]+$")||salesPersonName.matches("")||salesPersonName.matches("^[0-9]+$")){
                            System.out.println("Sales person's name can not"
                                    + " be empty or have space, must contain "
                                    + "a-z characters");
                            System.out.println("Enter Sales Person Name;");
                            salesPersonName = input2.nextLine();
                        }
                      //keeps looping until input is not null or contains just spaces
                    } while (salesPersonName.matches("^[\\s]+$")||salesPersonName.matches("")||salesPersonName.matches("^[0-9]+$"));
andyhunter -1 Newbie Poster

salesPersonName.matches("^[^a-z,^A-Z,\\s]$")

failes for everything (eg "John"), I dont know much about regex though.

thanks for your help, i found a page on here that had bits and pieces, i was only validating one character instead of multicharacters my regular expression required a +
([]+) looks like that <<. i have to figure out how to validate return key i.e. null in regex :(

andyhunter -1 Newbie Poster

can any one help please

andyhunter -1 Newbie Poster

the code does not validate spaces and results into moving onto the next line of code to which it should keep in a continious loop until valid data is entered. I have a problem with matching for whitespaces using \s as it doesnt work. many thanks

                    do{
                        /*if salesPersonName is null or just spaces then this
                          piece of code runs, displaus output and asks for input
                          which salespersoname = input 2
                        */
                        if (salesPersonName.matches("^[^a-z,^A-Z,\\s]$")){
                            System.out.println("Sales person's name can not"
                                    + " be empty or have space, must contain "
                                    + "a-z characters");
                            System.out.println("Enter Sales Person Name;");
                            salesPersonName = input2.nextLine();
                        }
                      //keeps looping until input is not null or contains just spaces
                    } while (salesPersonName.matches("^[^a-z,^A-Z,\\s]$"));
andyhunter -1 Newbie Poster

I copy-pasted your code and it works fine for me within the desired ranges. However you do realize that you have to enter a house number twice even if its right the first time?
Why not use a regular while loop?

the code was incorrect, house number should only loop if outside a valid range, therefore it keeps looping asking for house number if its not between 1-1000. i fixed it and its 100% working as i needed an if statement inside this do while, the do while worked if i placed only 1 piece of data range in but did not work for an or with two different bits of data and anything between 1 and 1000 came back as invalid then it did this twice and then went to next stage in the code, cheers a million anyway having the time to look at the bit of code.
one question, how do you validate spaces as i have been trying with "" only the longer the gap then the more spaces it allows to validate as im lookin for infinity amount of spaces?

andyhunter -1 Newbie Poster

got it sorted, needed an if statment inside the do while that was the same as the while true to keep the loop going only for false invalid data which it exits correctly if data is in the correct range.

andyhunter -1 Newbie Poster

part of bigger code but i cant understand why its not working in the correct range

Scanner input3 = new Scanner (System.in);
                        System.out.println("Enter House Number;");
                        houseNumber = input3.nextInt();
                        do {
                            System.out.println("You must enter a house number between 1                            and 1000");
                            System.out.println("Enter House Number;");
                            houseNumber = input3.nextInt();
                        }while ((houseNumber <1) || (houseNumber >1000));

it says i.e. 999 is wrong basically were it should accept and move onto the next stage but its stuck in the loop as it think 999 is wrong were it should be anything below 1 and above 1000 that is invalid and only looped.

Dukane commented: use code tags next time -1