Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2010
    Location
    Orlando, FL
    Posts
    154
    Thanks
    2
    Thanked 8 Times in 8 Posts

    Exclamation Problem with Sessions

    I'm trying to carry a string from one webpage to another. The user inputs some data on page 1, the info gets tested for certain elements, then gets sent to page 2. The problem is the strings aren't transferring and I don't know how to use sessions to transfer them. I need recipeNameEl, ingredientsEl, and descriptionsEl to be stored to a string and then transferred to the page the action="" attribute says. How can I accomplish this?

    Code:
    <script>
        function checkFields() {
            var recipeNameEl = document.getElementById( 'recipeName' );
            var ingredientsEl = document.getElementById( 'ingredients' );
            var descriptionEl = document.getElementById( 'description' );
            
            var helperMsg1 = 'You have not filled in all required fields.';
            var helperMsg2 = 'I thought I said no measurements! (No Numbers)';
            
            return notEmpty( recipeNameEl, ingredientsEl, descriptionEl, helperMsg1, helperMsg2 );
        }
    </script>
    
    <script type="text/javascript">
    function notEmpty( recipeNameEl, ingredientsEl, descriptionEl, helperMsg1, helperMsg2 ){
    	if(recipeNameEl.value.length == 0){
    		alert(helperMsg1);
    		recipeNameEl.focus();
    		return false;}
    
    	if(ingredientsEl.value.length == 0){
    		alert(helperMsg1);
    		ingredientsEl.focus();
    		return false;}
    	
    	if(descriptionEl.value.length == 0){
    		alert(helperMsg1);
    		descriptionEl.focus();
    		return false;}
    	
    	
    	var alphaExp = /^[a-zA-Z]+$/;
    	if(ingredientsEl.value.match(alphaExp)){
    	return true;
    		}else{
    		alert(helperMsg2);
    		ingredientsEl.focus();
    		return false;}
    	
    	return true;
    }
    
    </script>

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Looks like a Javascript session question, not PHP sessions.



    ------------
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •