Jump to content

Eggzorcist

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Posts posted by Eggzorcist

  1. I added //usage before the function but I still get the same error.

     

     Warning: Invalid argument supplied for foreach() in /Users/JPFoster/Sites/Event_Profiler/scripts/functions.php on line 213
    Column count doesn't match value count at row 1 

  2. So using the associative array method, how would I put the function together with the $_POST?

     

    I'm currently using

     addeventToPending($_POST['title'], $_POST['datepicker1'], $_POST['alternative1'], $_POST['timestart'], $_POST['datepicker1'], $_POST['alternative2'], $_POST['timefinish'], $_POST['Qdescription'], $_POST['elm1']); 

     

    and this isn't working... Any tips? I like to assoc idea however.

     

    Thanks!

  3. For some reason this function isn't working and I'm not quite sure why...

     

    Here's the function code, it doesn't give me any error, but it goes to the else and outputs error and doesn't add anything to the database... I'm really not sure why not. Any help would be greatly appreciated.

     

     

    function addeventToPending($eventTitle, $from1, $from2, $fromtime, $to1, $to2, $totime, $quickDesc, $description){
    
    $query = "INSERT INTO events (name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, sameday, status) VALUES ($eventTitle, $from1, $from2, $fromtime, $to1, $to2, $totime, $quickDesc, $description)";
    
    	$insert_query = mysql_query($query);
    
    if($insert_query){
    
    echo "Your event was put up for approval.";
    
    
    }
    
    else {
    
    
    echo "Error";
    }
    
    
    
    
    }
    

     

    Thanks!

  4. well this is the error I get.

     

     Notice: Undefined index: alternative1 in /Users/JPFoster/Sites/Event_Profiler/addevent.php on line 6
    
    Notice: Undefined index: alternative2 in /Users/JPFoster/Sites/Event_Profiler/addevent.php on line 6 

     

    My php is

     

     if($_POST){
    
    addeventToPending($_POST['title'], $_POST['datepicker1'], $_POST['alternative1'], $_POST['timestart'], $_POST['datepicker1'], $_POST['alternative2'], $_POST['timefinish'], $_POST['Qdescription'], $_POST['elm1']);
    
    } 

     

    everything works well until it hits that erorr. The only thing that is different about those two variables is that it's a disabled field... Do I have to make it an active field? Because I really don't want to give people the option to change it.

     

    Thanks

  5. I'm unsure why this is happening, but it seems like the form isn't defining my $_POST which are disabled form. The reason it is disabled it is because the previous field is a ajax which auto fills the next one. but it seems its not defining that post because of that...

     

    here's my forms.

     

     

    <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"/>
      <p>
    Event TItle:<br />
        <input type="text" name="title" id="title" />
        <br />
        <br />
        From:  </p>
      <p>
        <input name="datepicker1" type="text" id="datepicker1" value="Click here to select a date."/>
         <input type="text" disabled="disabled" id="alternate1" size="30"/>
        <br />
        </p>
      <p>Event starts at: <em>
        <input name="timestart" type="text" id="timestart" size="15" />
      </em><br />
        <br />
        To:</p>
      <p> <input type="text" id="datepicker2" value="Click here to select a date."/> <input type="text" disabled="disabled" id="alternate2" size="30"/> <br />
        </p>
      <p>Event finishes at: <em>
      <input name="timefinish" type="text" id="timefinish" size="15" />
      </em><br />
        <br />
        Quick Event Description:<br />
        <textarea name="Qdescription" cols="30" rows="4" id="Qdescription"></textarea>
        <br />
        <br />
        Event Page Description:<br />
        <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 50%" class="tinymce"></textarea>	    
        
        <br />
        <br />
        <input type="submit" name="save" value="Submit" id="submit" />
        <input type="reset" name="reset" value="Reset" />
      </p>
      </p>
    </form>
    

     

  6. I'm a bit unsure why this problem is accuring. I've always used done some of my forms like this. but when I do

    if(isset($_POST['post_form'])){
    register_user($_POST['username'], $_POST['password1'], $_POST['password2'], $_POST['email'], $_POST['clubname'], $_POST['clubposition']);	
    }

     

    It doesn't work properly. It executes whenever I get on that page - and doesn't execute when I press the submit button. Any alternatives?

     

    thanks a lot

     

  7. I'm developing an application which may have have a person on the same page writting something for quite a long period of time. I was wondering as my security is set up with sessions could these sessions die by the time you'd finish the form?

     

    Thanks

  8. You can just integrate the images with a simple html-based echo within your php, that would be by far the easiest. However, for a smooth alternative I'd use a javascript/ajax system. Also you may want to consider preloading all images or else it'll take too long to load them all.

  9. Keep in mind that my ajax skills are fairly low. I'm trying to create a ajax login which will be used mostly for the error messages and if there is no error the php script will detect the sessions and will go to the first logged in page. All it seems to be doing is putting the $_GET in the url, I can't see why it won't work.

     

     

    html code

    <div id="oneerror"></div>
    <div class="onecontent">
    
    <form name="loginform">
        <label>Username:
           <input type="text" name="username" id="username" />
        </label>
        Password: 
        <label>
          <input type="password" name="password" id="password" />
        </label> <input type='submit' id="submit" onclick=" ajaxFunction()" value="Login"/>
    </form>
    </div>

     

    ajax code

    // JavaScript Document
    
    
    
    function ajaxFunction(){
    var ajaxRequest;  // The variable that makes Ajax possible!
    
    try{
    	// Opera 8.0+, Firefox, Safari
    	ajaxRequest = new XMLHttpRequest();
    } catch (e){
    	// Internet Explorer Browsers
    	try{
    		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) {
    		try{
    			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    		} catch (e){
    			// Something went wrong
    			alert("Your browser is not compatible, please enable javascript.");
    			return false;
    		}
    	}
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
    	if(ajaxRequest.readyState == 4){
    
    		var ajaxDisplay = document.getElementById('oneerror');
    		ajaxDisplay.innerHTML = ajaxRequest.responseText;
    	}
    }
    var username = document.getElementById('username').value;
    var password = document.getElementById('password').value;
    
    var queryString = "?username=" + username + "&password=" + password;
    ajaxRequest.open("GET", "scripts/login.php" + queryString, true);
    ajaxRequest.send(null); 
    }
    
    //-->

     

     

    php login function code.

    <?php
    
    include('../function.php');
    
    
    login_user($_GET['username'], $_GET['password']);
    
    
    function login_user($username, $password){
    
    $username1 = secure_var($username);
    $password1 = md5(secure_var($password));
    
    if ($username != NULL and $password != NULL){
    
    	$login_query = mysql_query("SELECT * FROM user_info WHERE username = '$username1' AND password = '$password1'");
    
    	$login_status = mysql_num_rows($login_query);
    
    
    	if($login_status == 1){
    		echo "working";
    
    	set_login_sessions($username, $password);
    
    
    }
    
    	else {
    
    	echo "You have entered a wrong username and/or password.";
    
    	}
    
    }
    
    else {
    
    echo "Please enter a Username and Password";	
    
    }
    
    
    
    }
    
    
    
    ?>

     

    thanks for any help. :)

×
×
  • 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.