Jump to content

Doc20

Members
  • Posts

    46
  • Joined

  • Last visited

Posts posted by Doc20

  1. Ok, that's correct. Now go to include.php file and copy/paste this code there:

     

    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link) or die(mysql_error());
    
    $arr = array();
    
    while ($row = mysql_fetch_array($result)) {
      $arr = $row;
    }
    echo '<pre>'.print_r($arr, true).'</pre>';
    
    exit;
    

     

    Code:

     

    <?php
    
    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxx')or die(mysql_error());
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxx'', true) or die(mysql_error());
    
    $recruit_db = mysql_select_db('doggysty_recruitment', $recruit_link)or die(mysql_error());
    $webspell_db = mysql_select_db('doggysty_site', $webspell_link)or die(mysql_error());
    
    //end connections
    
    //define variables
    
    $clan_name = "Select United Players";
    $clan_tag = "SuP";
    
    //end definition of variables
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link) or die(mysql_error());
    
    $arr = array();
    
    while ($row = mysql_fetch_array($result)) {
      $arr = $row;
    }
    echo '<pre>'.print_r($arr, true).'</pre>';
    
    exit;
    
    ?>

     

    The same output we had before at the top of the page.

     

    Array

    (

        [0] => notes

        [Field] => notes

        [1] => longtext

        [Type] => longtext

        [2] => NO

        [Null] => NO

        [3] =>

        [Key] =>

        [4] =>

        [Default] =>

        [5] =>

        [Extra] =>

    )

  2. Hm.... it's very weird.

    Open up your phpmyadmin application and go to database named " doggysty_recruitment ", click on the SQL tab and copy/paste this code:

    EXPLAIN `doggysty_recruitment`.`applications`
    

     

    Field Type Null Key Default Extra

    u_id int(11) NO PRI NULL auto_increment

    id int(11) NO NULL

    site_id int(11) NO NULL

    timestamp int(55) NO NULL

    ip varchar(100) NO NULL

    name varchar(250) NO NULL

    username varchar(250) NO NULL

    steam varchar(250) NO NULL

    xfire varchar(250) NO NULL

    email varchar(250) NO NULL

    games varchar(1000) NO NULL

    why_join longtext NO NULL

    clan_history longtext NO NULL

    recruit varchar(300) NO NULL

    age int(3) NO NULL

    location varchar(250) NO NULL

    microphone int(11) NO NULL

    recruit_style int(11) NO NULL

    app_status int(11) NO NULL

    division varchar(150) NO NULL

    notes longtext NO NULL

  3. Put in php die() function, to be like this:

     

    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxx') or die(mysql_error());
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxx') or die(mysql_error());
    
    $recruit_db = mysql_select_db('doggysty_recruitment', $recruit_link) or die(mysql_error());
    $webspell_db = mysql_select_db('doggysty_site', $webspell_link) or die(mysql_error());
    

     

    Nothing has changed.  Connecting to database just fine.  Same output.  So it connects to both recruit and webspell just fine.  Same output as before.

     

    12

    Array

    (

        [0] => notes

        [Field] => notes

        [1] => longtext

        [Type] => longtext

        [2] => NO

        [Null] => NO

        [3] =>

        [Key] =>

        [4] =>

        [Default] =>

        [5] =>

        [Extra] =>

    )

     

    I chose a different username to prove that it in fact is connecting to webspell.. This time I selected the user that has user_id 12 on the site.

     

     

  4. Not sure if this is what you meant.  I appended the select_db function to their respective variables.  If I assign a new variable to the select_db respectively, won't that mess up all the existing MYSQL queries that only use $recruit_link and $webspell_link?

     

    At any rate, here is the new declarations I have in my includes file.

     

    No, Doc, just assign them to new variables and try again, for example:

     

    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx');
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx', true);
    
    $db_name1 = mysql_select_db('doggysty_recruitment', $recruit_link);
    $db_name2 = mysql_select_db('doggysty_site', $webspell_link);
    

     

    Ok, changed to:

    <?php
    
    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxx');
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxx', true);
    
    $recruit_db = mysql_select_db('doggysty_recruitment', $recruit_link);
    $webspell_db = mysql_select_db('doggysty_site', $webspell_link);
    
    //end connections
    
    //define variables
    
    $clan_name = "Select United Players";
    $clan_tag = "SuP";
    
    //end definition of variables
    
    ?>

     

    Still the same output with nothing inserted to table  :wtf:

     

    Array

    (

        [0] => notes

        [Field] => notes

        [1] => longtext

        [Type] => longtext

        [2] => NO

        [Null] => NO

        [3] =>

        [Key] =>

        [4] =>

        [Default] =>

        [5] =>

        [Extra] =>

    )

  5. Your form fields and data has came from it is just fine.

    Do you have access to databases through any desktop or browser applications, like phpmyadmin, mysql workbench and etc ?

     

    I have access through phpmyadmin, yes.

     

    @Doc, I think, I got it.

    According the file bellow, you're overriding or overwriting (I'm not sure how proper to say  in English) mysql_select_db('name'), you must assign it to different variables.

    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx');
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx', true);
    
    mysql_select_db('doggysty_recruitment', $recruit_link);
    mysql_select_db('doggysty_site', $webspell_link);
    

     

    Not sure if this is what you meant.  I appended the select_db function to their respective variables.  If I assign a new variable to the select_db respectively, won't that mess up all the existing MYSQL queries that only use $recruit_link and $webspell_link?

     

    At any rate, here is the new declarations I have in my includes file.

     

    <?php
    
    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxx');
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxx', true);
    
    $recruit_link .= mysql_select_db('doggysty_recruitment', $recruit_link);
    $webspell_link .= mysql_select_db('doggysty_site', $webspell_link);
    
    //end connections
    
    //define variables
    
    $clan_name = "Select United Players";
    $clan_tag = "SuP";
    
    //end definition of variables
    
    ?>

  6. I put it before $application = mysql_query(INSERT INTO...)

     

    <title><?php echo $clan_tag ; ini_set('display_errors', 1); error_reporting(E_ALL); ?> Recruitment: Apply to join</title>
    <div id="col-2">
    
    <div class="CntBox">
    	<div class="CntHead">
    		<div class="CntHeadInfo">Apply to become a member of <?php echo $clan_name; ?> </div>
    	</div>
    	<div class="CntFill">
    		<div class="CntInfo">
    		  <div align="center">
    		    
    		    <form id="apply" name="apply" method="post" action="">
    		    <h1><?php echo $clan_tag; ?> Application</h1>
                      <p>Thank you for expressing interest in joining <?php echo $clan_name; ?>!  We have a simple application form we'd like you to fill out in order for us to get to know the basics about you!  We wish you the best of luck in your application process -- we look forward to speaking with you soon! </p>
                      <hr />
                      <p align="center"><strong>Name</strong><br />
                      <em>Please give your game handle, or name you will be using as a member of this clan.</em><br />
                      <input type="text" name="name" id="name" />
                      </p>
                      <p align="center"><strong>Informal Name</strong><br />
                        <em>What other name can we call you.  This can be your first name, shortened version of your firstname, etc. (e.g. "Bill")</em><br />
                        <label for="i_name"></label>
                        <input type="text" name="i_name" id="i_name" />
                      </p>
    <p align="center"><strong>Registered Username</strong><br />
      <em>Please provide your username on the forums. Registering on the forums is a requirement to be a member of the clan.</em><br />
      <input type="text" name="username" id="username" />
    </p>
                      <p align="center"><strong>Steam Username</strong><br />
                        <input type="text" name="steam" id="steam" />
                      </p>
                      <p align="center"><strong>Xfire Username</strong><br />
                        <input type="text" name="xfire" id="xfire" />
                      </p>
                      <p align="center"><strong>E-Mail Address</strong><em><br />
                      We may periodically send you an e-mail. Additionally, you will receive application status (if you are accepted or denied) to this e-mail. Please provide a legitimate e-mail address.</em><br />
                      <input name="email" type="email" id="email" />
                      </p>
                      <p align="center"><strong>Games you play</strong><em><br />
                      Please list all games you play (especially games supported by <?php echo $clan_name; ?>).</em><br />
                      <textarea name="games" id="games" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>Age</strong><br />
                      <em>You must be at least 15 years of age to join</em><br />
                      <input type="text" name="age" id="age" />
                      </p>
                      <p align="center"><strong>Location</strong><em><br />
                      Where are you from? Please provide a country and a region (e.g. USA: Eastern Coast). This helps us decide where to get servers, etc)</em><br />
                      <input type="text" name="location" id="location" />
                      </p>
                      <p align="center"><strong>Do you have a microphone?</strong><br />
                      <em>We use TeamSpeak 3 for a lot of our in-game experience.</em> <em>Do you have a microphone so that you too can be a part of this experience?</em><br />
                      <select name="microphone" id="microphone">
                        <option value="0" selected= "selected">Please Answer</option>
                        <option value="1">Yes I do</option>
                        <option value="2">No, I do not.  But I am willing to purchase one</option>
                        <option value="3">No, I do not.  I am not willing to get one</option>
                      </select>
                      </p>
                      <p align="center"><strong>Why do you want to join <?php echo $clan_tag; ?>?</strong><br />
                      <em>Tell us about why you would like to join this clan?  We are looking for serious individuals, so the more time and effort you put into this will help enhance your application.</em><br />
                      <label for="why_join"></label>
                      <textarea name="why_join" id="why_join" cols="90" rows="10"></textarea>
                      </p>
                      <p align="center"><strong>Please tell us a little bit about your previous clan history.</strong><br />
                        <em>Tell us your history. What clans have you been in?  What time period did you spend in that clan?  What is the reason you left/kicked out of that clan?  What rank/responsibilities did you hold in that clan? </em><br />
                        <label for="clan_history"></label>
                          <textarea name="clan_history" id="clan_history" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>How did you find out about us?</strong><br />
                        <select name="recruit_style" id="recruit_style">
                          <option value="0" selected="selected">Please Answer</option>
                          <option value="1">Recruited by a member</option>
                          <option value="2">Top 100 clans</option>
                          <option value="3">Search Engine (Google, Yahoo, etc)</option>
                          <option value="4">Other (please describe)</option>
                        </select>
                      </p>
                      <p align="center"><strong>Who recruited you?</strong><br />
                        <em>If you selected that someone recruited you above, please give that person's name.  We pride community, so if a member of ours is responsible for bringing you here, we want to give them credit!</em><br />
                        <label for="recruit"></label>
                        <input name="recruit" type="text" id="recruit" value="Self recruit" />
                        <input type="hidden" name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
                        <input type='hidden' id='time' name='time' value='<?php echo $_SERVER['REQUEST_TIME']; ?>'>
                      </p>
                      <p align="center">
                        <input type="submit" name="submit" id="submit" value="Send Application" />
                      </p>
    		    </form>
                    <?php
    
    			if (isset($_POST['submit']))
    			{
    				/*echo '<pre>'.print_r($_POST, true).'</pre>'; exit;*/
    				$application_id = substr(number_format(time() * rand(),0,'',''),0,6);
    				include ("include.php");
    
    				$timestamp = $_SERVER['REQUEST_TIME'];
    				$timestamp2 = $_POST['time'];					
    				$site_username = $_POST['username'];
    				$name = htmlspecialchars($_POST['name']);
    
    				 $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link) or die(mysql_error());
    				 while($get_s_id = mysql_fetch_array($get_site_id))
    				 { 
    
    $site_id = $get_s_id['userID'];
    }  					 
    
    
    				echo '<pre>'.print_r($site_id, true).'</pre>'; 
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link) or die(mysql_error());
    
    $arr = array();
    
    while ($row = mysql_fetch_array($result)) {
      $arr = $row;
    }
    echo '<pre>'.print_r($arr, true).'</pre>';
    
    exit;
    
    				$app_application = mysql_query("INSERT INTO applications 
    (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip, notes) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]', '') ", $recruit_link) or die(mysql_error()); 
    
    if (isset($app_application)) { echo "good"; }
    			}
    
    			elseif (!isset($app_application))
    			{
    				echo "please submit";
    			}				
    
    
    			?>
    		    <p> </p>
    
    
    
                  </div>
              </div>
    	</div>
    	<div class="CntFooter"></div>
    </div>
    
    
    
    
    </div>

     

    Still only outputs:

    3

    Array

    (

        [0] => notes

        [Field] => notes

        [1] => longtext

        [Type] => longtext

        [2] => NO

        [Null] => NO

        [3] =>

        [Key] =>

        [4] =>

        [Default] =>

        [5] =>

        [Extra] =>

    )

     

    I don't know what I am doing wrong  :confused:

     

     

    Here is a link to the page if you wanna try it:  http://selectunitedplayers.com/news_2/blahblityblah/recruit/index.php?page=apply

  7. Compare, what you want to do.

    You have to create a new table structure according the html form fields or backward.

    // form data values
    
    [name] => Doc20
        [i_name] => Doc
        [username] => Doc
        [steam] => N/A
        [xfire] => bagpiper4414
        [email] => doc@test.com
        [games] => all the games I play
        [age] => 37
        [location] => USA: North Coast
        [microphone] => 2
        [why_join] => Because I like it!
        [clan_history] => Well, this is my first 
        [recruit_style] => 1
        [recruit] => Doggy Style
        [userIP] => x.x.x.x
        [time] => 1344143935
        [submit] => Send Application
    
    // table structure
    
    Field] => notes
        [1] => longtext
        [Type] => longtext
        [2] => NO
        [Null] => NO
        [3] =>
        [Key] =>
        [4] =>
        [Default] =>
        [5] => 
    
    

     

    I am not quite sure what you mean.  The column, 'notes' is not used during the form submission.  It is a field reserved for later on down the chain and is achieved on another page by updating.  Is there something wrong with my table structure?  I have not changed the structure since the form went from functional to non-functional.  I really haven't changed anything.. that's why I am so stumped.

     

    Anywho....

     

    Here is the current table structure I have.   

     

    -- Table structure for table `applications`

    --

     

    CREATE TABLE IF NOT EXISTS `applications` (

      `u_id` int(11) NOT NULL AUTO_INCREMENT,

      `id` int(11) NOT NULL,

      `site_id` int(11) NOT NULL,

      `timestamp` int(55) NOT NULL,

      `ip` varchar(100) COLLATE utf8_unicode_ci NOT NULL,

      `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `username` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `steam` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `xfire` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `email` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `games` varchar(1000) COLLATE utf8_unicode_ci NOT NULL,

      `why_join` longtext COLLATE utf8_unicode_ci NOT NULL,

      `clan_history` longtext COLLATE utf8_unicode_ci NOT NULL,

      `recruit` varchar(300) COLLATE utf8_unicode_ci NOT NULL,

      `age` int(3) NOT NULL,

      `location` varchar(250) COLLATE utf8_unicode_ci NOT NULL,

      `microphone` int(11) NOT NULL,

      `recruit_style` int(11) NOT NULL,

      `app_status` int(11) NOT NULL,

      `division` varchar(150) COLLATE utf8_unicode_ci NOT NULL,

      `notes` longtext COLLATE utf8_unicode_ci NOT NULL,

      PRIMARY KEY (`u_id`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;

  8. Add this instead of code above.

     

    
    echo '<pre>'.print_r($site_id, true).'</pre>'; 
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link) or die(mysql_error());
    
    $arr = array();
    
    while ($row = mysql_fetch_array($result)) {
      $arr = $row;
    }
    echo '<pre>'.print_r($arr, true).'</pre>';
    
    exit;
    

     

    Full code:

    <title><?php echo $clan_tag ; ini_set('display_errors', 1); error_reporting(E_ALL); ?> Recruitment: Apply to join</title>
    <div id="col-2">
    
    <div class="CntBox">
    	<div class="CntHead">
    		<div class="CntHeadInfo">Apply to become a member of <?php echo $clan_name; ?> </div>
    	</div>
    	<div class="CntFill">
    		<div class="CntInfo">
    		  <div align="center">
    		    
    		    <form id="apply" name="apply" method="post" action="">
    		    <h1><?php echo $clan_tag; ?> Application</h1>
                      <p>Thank you for expressing interest in joining <?php echo $clan_name; ?>!  We have a simple application form we'd like you to fill out in order for us to get to know the basics about you!  We wish you the best of luck in your application process -- we look forward to speaking with you soon! </p>
                      <hr />
                      <p align="center"><strong>Name</strong><br />
                      <em>Please give your game handle, or name you will be using as a member of this clan.</em><br />
                      <input type="text" name="name" id="name" />
                      </p>
                      <p align="center"><strong>Informal Name</strong><br />
                        <em>What other name can we call you.  This can be your first name, shortened version of your firstname, etc. (e.g. "Bill")</em><br />
                        <label for="i_name"></label>
                        <input type="text" name="i_name" id="i_name" />
                      </p>
    <p align="center"><strong>Registered Username</strong><br />
      <em>Please provide your username on the forums. Registering on the forums is a requirement to be a member of the clan.</em><br />
      <input type="text" name="username" id="username" />
    </p>
                      <p align="center"><strong>Steam Username</strong><br />
                        <input type="text" name="steam" id="steam" />
                      </p>
                      <p align="center"><strong>Xfire Username</strong><br />
                        <input type="text" name="xfire" id="xfire" />
                      </p>
                      <p align="center"><strong>E-Mail Address</strong><em><br />
                      We may periodically send you an e-mail. Additionally, you will receive application status (if you are accepted or denied) to this e-mail. Please provide a legitimate e-mail address.</em><br />
                      <input name="email" type="email" id="email" />
                      </p>
                      <p align="center"><strong>Games you play</strong><em><br />
                      Please list all games you play (especially games supported by <?php echo $clan_name; ?>).</em><br />
                      <textarea name="games" id="games" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>Age</strong><br />
                      <em>You must be at least 15 years of age to join</em><br />
                      <input type="text" name="age" id="age" />
                      </p>
                      <p align="center"><strong>Location</strong><em><br />
                      Where are you from? Please provide a country and a region (e.g. USA: Eastern Coast). This helps us decide where to get servers, etc)</em><br />
                      <input type="text" name="location" id="location" />
                      </p>
                      <p align="center"><strong>Do you have a microphone?</strong><br />
                      <em>We use TeamSpeak 3 for a lot of our in-game experience.</em> <em>Do you have a microphone so that you too can be a part of this experience?</em><br />
                      <select name="microphone" id="microphone">
                        <option value="0" selected= "selected">Please Answer</option>
                        <option value="1">Yes I do</option>
                        <option value="2">No, I do not.  But I am willing to purchase one</option>
                        <option value="3">No, I do not.  I am not willing to get one</option>
                      </select>
                      </p>
                      <p align="center"><strong>Why do you want to join <?php echo $clan_tag; ?>?</strong><br />
                      <em>Tell us about why you would like to join this clan?  We are looking for serious individuals, so the more time and effort you put into this will help enhance your application.</em><br />
                      <label for="why_join"></label>
                      <textarea name="why_join" id="why_join" cols="90" rows="10"></textarea>
                      </p>
                      <p align="center"><strong>Please tell us a little bit about your previous clan history.</strong><br />
                        <em>Tell us your history. What clans have you been in?  What time period did you spend in that clan?  What is the reason you left/kicked out of that clan?  What rank/responsibilities did you hold in that clan? </em><br />
                        <label for="clan_history"></label>
                          <textarea name="clan_history" id="clan_history" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>How did you find out about us?</strong><br />
                        <select name="recruit_style" id="recruit_style">
                          <option value="0" selected="selected">Please Answer</option>
                          <option value="1">Recruited by a member</option>
                          <option value="2">Top 100 clans</option>
                          <option value="3">Search Engine (Google, Yahoo, etc)</option>
                          <option value="4">Other (please describe)</option>
                        </select>
                      </p>
                      <p align="center"><strong>Who recruited you?</strong><br />
                        <em>If you selected that someone recruited you above, please give that person's name.  We pride community, so if a member of ours is responsible for bringing you here, we want to give them credit!</em><br />
                        <label for="recruit"></label>
                        <input name="recruit" type="text" id="recruit" value="Self recruit" />
                        <input type="hidden" name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
                        <input type='hidden' id='time' name='time' value='<?php echo $_SERVER['REQUEST_TIME']; ?>'>
                      </p>
                      <p align="center">
                        <input type="submit" name="submit" id="submit" value="Send Application" />
                      </p>
    		    </form>
                    <?php
    
    			if (isset($_POST['submit']))
    			{
    				/*echo '<pre>'.print_r($_POST, true).'</pre>'; exit;*/
    				$application_id = substr(number_format(time() * rand(),0,'',''),0,6);
    				include ("include.php");
    
    				$timestamp = $_SERVER['REQUEST_TIME'];
    				$timestamp2 = $_POST['time'];					
    				$site_username = $_POST['username'];
    				$name = htmlspecialchars($_POST['name']);
    
    				 $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link) or die(mysql_error());
    				 while($get_s_id = mysql_fetch_array($get_site_id))
    				 { 
    
    $site_id = $get_s_id['userID'];
    }  					 
    
    
    				echo '<pre>'.print_r($site_id, true).'</pre>'; 
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link) or die(mysql_error());
    
    $arr = array();
    
    while ($row = mysql_fetch_array($result)) {
      $arr = $row;
    }
    echo '<pre>'.print_r($arr, true).'</pre>';
    
    exit;
    
    				$app_application = mysql_query("INSERT INTO applications 
    (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 
    
    if (isset($app_application)) { echo "good"; }
    			}
    
    			elseif (!isset($app_application))
    			{
    				echo "please submit";
    			}				
    
    
    			?>
    		    <p> </p>
    
    
    
                  </div>
              </div>
    	</div>
    	<div class="CntFooter"></div>
    </div>
    
    
    
    
    </div>

     

    Here is the print out.

     

    3

    Array

    (

        [0] => notes

        [Field] => notes

        [1] => longtext

        [Type] => longtext

        [2] => NO

        [Null] => NO

        [3] =>

        [Key] =>

        [4] =>

        [Default] =>

        [5] =>

  9. Hey Doc20,

    immediately before -> $app_application = mysql_query("INSERT INTO applications ..... etc ), add this code and post out the result. 

     

    echo '<pre>'.print_r($user_id, true).'</pre>'; 
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link);
    
    echo '<pre>'.var_dump($result).'</pre>';
    
    exit; 
    

     

    Here is the code with your suggestion:

     

    <title><?php echo $clan_tag ; ini_set('display_errors', 1); error_reporting(E_ALL); ?> Recruitment: Apply to join</title>
    <div id="col-2">
    
    <div class="CntBox">
    	<div class="CntHead">
    		<div class="CntHeadInfo">Apply to become a member of <?php echo $clan_name; ?> </div>
    	</div>
    	<div class="CntFill">
    		<div class="CntInfo">
    		  <div align="center">
    		    
    		    <form id="apply" name="apply" method="post" action="">
    		    <h1><?php echo $clan_tag; ?> Application</h1>
                      <p>Thank you for expressing interest in joining <?php echo $clan_name; ?>!  We have a simple application form we'd like you to fill out in order for us to get to know the basics about you!  We wish you the best of luck in your application process -- we look forward to speaking with you soon! </p>
                      <hr />
                      <p align="center"><strong>Name</strong><br />
                      <em>Please give your game handle, or name you will be using as a member of this clan.</em><br />
                      <input type="text" name="name" id="name" />
                      </p>
                      <p align="center"><strong>Informal Name</strong><br />
                        <em>What other name can we call you.  This can be your first name, shortened version of your firstname, etc. (e.g. "Bill")</em><br />
                        <label for="i_name"></label>
                        <input type="text" name="i_name" id="i_name" />
                      </p>
    <p align="center"><strong>Registered Username</strong><br />
      <em>Please provide your username on the forums. Registering on the forums is a requirement to be a member of the clan.</em><br />
      <input type="text" name="username" id="username" />
    </p>
                      <p align="center"><strong>Steam Username</strong><br />
                        <input type="text" name="steam" id="steam" />
                      </p>
                      <p align="center"><strong>Xfire Username</strong><br />
                        <input type="text" name="xfire" id="xfire" />
                      </p>
                      <p align="center"><strong>E-Mail Address</strong><em><br />
                      We may periodically send you an e-mail. Additionally, you will receive application status (if you are accepted or denied) to this e-mail. Please provide a legitimate e-mail address.</em><br />
                      <input name="email" type="email" id="email" />
                      </p>
                      <p align="center"><strong>Games you play</strong><em><br />
                      Please list all games you play (especially games supported by <?php echo $clan_name; ?>).</em><br />
                      <textarea name="games" id="games" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>Age</strong><br />
                      <em>You must be at least 15 years of age to join</em><br />
                      <input type="text" name="age" id="age" />
                      </p>
                      <p align="center"><strong>Location</strong><em><br />
                      Where are you from? Please provide a country and a region (e.g. USA: Eastern Coast). This helps us decide where to get servers, etc)</em><br />
                      <input type="text" name="location" id="location" />
                      </p>
                      <p align="center"><strong>Do you have a microphone?</strong><br />
                      <em>We use TeamSpeak 3 for a lot of our in-game experience.</em> <em>Do you have a microphone so that you too can be a part of this experience?</em><br />
                      <select name="microphone" id="microphone">
                        <option value="0" selected= "selected">Please Answer</option>
                        <option value="1">Yes I do</option>
                        <option value="2">No, I do not.  But I am willing to purchase one</option>
                        <option value="3">No, I do not.  I am not willing to get one</option>
                      </select>
                      </p>
                      <p align="center"><strong>Why do you want to join <?php echo $clan_tag; ?>?</strong><br />
                      <em>Tell us about why you would like to join this clan?  We are looking for serious individuals, so the more time and effort you put into this will help enhance your application.</em><br />
                      <label for="why_join"></label>
                      <textarea name="why_join" id="why_join" cols="90" rows="10"></textarea>
                      </p>
                      <p align="center"><strong>Please tell us a little bit about your previous clan history.</strong><br />
                        <em>Tell us your history. What clans have you been in?  What time period did you spend in that clan?  What is the reason you left/kicked out of that clan?  What rank/responsibilities did you hold in that clan? </em><br />
                        <label for="clan_history"></label>
                          <textarea name="clan_history" id="clan_history" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>How did you find out about us?</strong><br />
                        <select name="recruit_style" id="recruit_style">
                          <option value="0" selected="selected">Please Answer</option>
                          <option value="1">Recruited by a member</option>
                          <option value="2">Top 100 clans</option>
                          <option value="3">Search Engine (Google, Yahoo, etc)</option>
                          <option value="4">Other (please describe)</option>
                        </select>
                      </p>
                      <p align="center"><strong>Who recruited you?</strong><br />
                        <em>If you selected that someone recruited you above, please give that person's name.  We pride community, so if a member of ours is responsible for bringing you here, we want to give them credit!</em><br />
                        <label for="recruit"></label>
                        <input name="recruit" type="text" id="recruit" value="Self recruit" />
                        <input type="hidden" name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
                        <input type='hidden' id='time' name='time' value='<?php echo $_SERVER['REQUEST_TIME']; ?>'>
                      </p>
                      <p align="center">
                        <input type="submit" name="submit" id="submit" value="Send Application" />
                      </p>
    		    </form>
                    <?php
    
    			if (isset($_POST['submit']))
    			{
    				/*echo '<pre>'.print_r($_POST, true).'</pre>'; exit;*/
    				$application_id = substr(number_format(time() * rand(),0,'',''),0,6);
    				include ("include.php");
    
    				$timestamp = $_SERVER['REQUEST_TIME'];
    				$timestamp2 = $_POST['time'];					
    				$site_username = $_POST['username'];
    				$name = htmlspecialchars($_POST['name']);
    
    				 $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link) or die(mysql_error());
    				 while($get_s_id = mysql_fetch_array($get_site_id))
    				 { 
    
    $site_id = $get_s_id['userID'];
    }  					 
    
    
    				echo '<pre>'.print_r($user_id, true).'</pre>'; 
    
    $result = mysql_query('EXPLAIN `doggysty_recruitment`.`applications`', $recruit_link);
    
    echo '<pre>'.var_dump($result).'</pre>';
    
    exit; 
    
    				$app_application = mysql_query("INSERT INTO applications 
    (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 
    
    if (isset($app_application)) { echo "good"; }
    			}
    
    			elseif (!isset($app_application))
    			{
    				echo "please submit";
    			}				
    
    
    			?>
    		    <p> </p>
    
    
    
                  </div>
              </div>
    	</div>
    	<div class="CntFooter"></div>
    </div>
    
    
    
    
    </div>

     

    Here is the print out. 

     

    Notice: Undefined variable: user_id in /home/doggysty/public_html/news_2/blahblityblah/recruit/source/apply.php on line 111

    resource(9) of type (mysql result)

     

    I am not quite sure.. but I don't have a variable $user_id in my code..  Did you mean another variable?

  10. In this query  -> $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link), your link_identifier is $webspell_link!

    But....here -> $app_application = mysql_query("INSERT INTO applications (id, site_id, timestamp, name, c_name.........) etc.... your link_identifier is  $recruit_link!

    Can you explain this ?

     

    The $webspell_link identifier is used to connect to the main website this project will 'eventually' be integrated into.  So that specific command grabs the user data (the user's registration ID) from the website's database.  This part ironically enough works just fine, as it was before this application form stopped working.  If the user put a username on "Registered Username" that matched a user on the website, it grabs that user ID.  The output data I gave you, has the correct ID for the username I put in there.

     

    The $recruit_link is the identifer for the portal that I am asking for help with.  It is used strictly for the portal.  It is the database that needs to be connected/inserted/updated on this portal.  As such, it is the database that the application is NOT posting to. :(

     

    Here is my connect declarations for these, in case I've done something wrong on that front....:

     

    //connect to databases
    $recruit_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx');
    $webspell_link = mysql_connect('localhost', 'doggysty_recruit', 'xxxxxxxxxx', true);
    
    mysql_select_db('doggysty_recruitment', $recruit_link);
    mysql_select_db('doggysty_site', $webspell_link);

     

    Thanks for everyone's help, thus far.

     

  11. I added this to the bottom of the code

    	echo '$_POST array:<pre>';
    print_r($app_application);
    echo '</pre>';

     

    Before it submits the form, it says: Notice:  Undefined variable: app_application in /home/doggysty/public_html/news_2/blahblityblah/recruit/source/apply.php on

     

    After submitting the form, nothing is displayed.. and nothing is outputted.

     

    How about posting the whole script in one set of

     . . . 

    tags, including the print_r() you just added.

     

    Here is the full set of code.

     

    <title><?php echo $clan_tag ; ini_set('display_errors', 1); error_reporting(E_ALL); ?> Recruitment: Apply to join</title>
    <div id="col-2">
    
    <div class="CntBox">
    	<div class="CntHead">
    		<div class="CntHeadInfo">Apply to become a member of <?php echo $clan_name; ?> </div>
    	</div>
    	<div class="CntFill">
    		<div class="CntInfo">
    		  <div align="center">
    		    
    		    <form id="apply" name="apply" method="post" action="index.php?page=apply">
    		    <h1><?php echo $clan_tag; ?> Application</h1>
                      <p>Thank you for expressing interest in joining <?php echo $clan_name; ?>!  We have a simple application form we'd like you to fill out in order for us to get to know the basics about you!  We wish you the best of luck in your application process -- we look forward to speaking with you soon! </p>
                      <hr />
                      <p align="center"><strong>Name</strong><br />
                      <em>Please give your game handle, or name you will be using as a member of this clan.</em><br />
                      <input type="text" name="name" id="name" />
                      </p>
                      <p align="center"><strong>Informal Name</strong><br />
                        <em>What other name can we call you.  This can be your first name, shortened version of your firstname, etc. (e.g. "Bill")</em><br />
                        <label for="i_name"></label>
                        <input type="text" name="i_name" id="i_name" />
                      </p>
    <p align="center"><strong>Registered Username</strong><br />
      <em>Please provide your username on the forums. Registering on the forums is a requirement to be a member of the clan.</em><br />
      <input type="text" name="username" id="username" />
    </p>
                      <p align="center"><strong>Steam Username</strong><br />
                        <input type="text" name="steam" id="steam" />
                      </p>
                      <p align="center"><strong>Xfire Username</strong><br />
                        <input type="text" name="xfire" id="xfire" />
                      </p>
                      <p align="center"><strong>E-Mail Address</strong><em><br />
                      We may periodically send you an e-mail. Additionally, you will receive application status (if you are accepted or denied) to this e-mail. Please provide a legitimate e-mail address.</em><br />
                      <input name="email" type="email" id="email" />
                      </p>
                      <p align="center"><strong>Games you play</strong><em><br />
                      Please list all games you play (especially games supported by <?php echo $clan_name; ?>).</em><br />
                      <textarea name="games" id="games" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>Age</strong><br />
                      <em>You must be at least 15 years of age to join</em><br />
                      <input type="text" name="age" id="age" />
                      </p>
                      <p align="center"><strong>Location</strong><em><br />
                      Where are you from? Please provide a country and a region (e.g. USA: Eastern Coast). This helps us decide where to get servers, etc)</em><br />
                      <input type="text" name="location" id="location" />
                      </p>
                      <p align="center"><strong>Do you have a microphone?</strong><br />
                      <em>We use TeamSpeak 3 for a lot of our in-game experience.</em> <em>Do you have a microphone so that you too can be a part of this experience?</em><br />
                      <select name="microphone" id="microphone">
                        <option value="0" selected= "selected">Please Answer</option>
                        <option value="1">Yes I do</option>
                        <option value="2">No, I do not.  But I am willing to purchase one</option>
                        <option value="3">No, I do not.  I am not willing to get one</option>
                      </select>
                      </p>
                      <p align="center"><strong>Why do you want to join <?php echo $clan_tag; ?>?</strong><br />
                      <em>Tell us about why you would like to join this clan?  We are looking for serious individuals, so the more time and effort you put into this will help enhance your application.</em><br />
                      <label for="why_join"></label>
                      <textarea name="why_join" id="why_join" cols="90" rows="10"></textarea>
                      </p>
                      <p align="center"><strong>Please tell us a little bit about your previous clan history.</strong><br />
                        <em>Tell us your history. What clans have you been in?  What time period did you spend in that clan?  What is the reason you left/kicked out of that clan?  What rank/responsibilities did you hold in that clan? </em><br />
                        <label for="clan_history"></label>
                          <textarea name="clan_history" id="clan_history" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>How did you find out about us?</strong><br />
                        <select name="recruit_style" id="recruit_style">
                          <option value="0" selected="selected">Please Answer</option>
                          <option value="1">Recruited by a member</option>
                          <option value="2">Top 100 clans</option>
                          <option value="3">Search Engine (Google, Yahoo, etc)</option>
                          <option value="4">Other (please describe)</option>
                        </select>
                      </p>
                      <p align="center"><strong>Who recruited you?</strong><br />
                        <em>If you selected that someone recruited you above, please give that person's name.  We pride community, so if a member of ours is responsible for bringing you here, we want to give them credit!</em><br />
                        <label for="recruit"></label>
                        <input name="recruit" type="text" id="recruit" value="Self recruit" />
                        <input type="hidden" name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
                        <input type='hidden' id='time' name='time' value='<?php echo $_SERVER['REQUEST_TIME']; ?>'>
                      </p>
                      <p align="center">
                        <input type="submit" name="submit" id="submit" value="Send Application" />
                      </p>
    		    </form>
                    <?php
    
    			if (isset($_POST['submit']))
    			{
    				echo '<pre>'.print_r($_POST, true).'</pre>'; exit;
    				$application_id = substr(number_format(time() * rand(),0,'',''),0,6);
    									include ("include.php");
    
    				$timestamp = $_SERVER['REQUEST_TIME'];
    				$timestamp2 = $_POST['time'];					
    				$site_username = $_POST['username'];
    				$name = htmlspecialchars($_POST['name']);
    
    				 $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link) or die(mysql_error());
    				 while($get_s_id = mysql_fetch_array($get_site_id))
    				 { 
    
    $site_id = $get_s_id['userID'];
    }  					 
    
    
    
    				$app_application = mysql_query("INSERT INTO applications 
    (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 
    
    if (isset($app_application)) { echo "good"; }
    			}
    
    			elseif (!isset($app_application))
    			{
    				echo "please submit";
    			}				
    
    
    			?>
    		    <p> </p>
    
    
    
                  </div>
              </div>
    	</div>
    	<div class="CntFooter"></div>
    </div>
    
    
    
    
    </div>

     

    Here is the output received from your suggestion.  It all looks good to me based on the data I sent in.

     

     

     

    My apologies.  I misunderstood what you meant.  I have not used this particular syntax before.  So I thought it was meant to have the variable $app_application in the ().

     

     

  12. Well, this form was originally working when I first made/tested it.. However,  I tried to submit data to it again after adding functionality to another aspect of this project (not on the same page) that needed tested, and the data is not submitted any longer  :wtf:.  I've double, triple, and quadriple checked to make sure I got all the extra ','s and all that, and I cannot find it.  I added ini_set('display_errors', 1); error_reporting(E_ALL) to the page to see if there were any errors, NONE.    I know that whoever figures out why it is working will find something small and minor, and I will feel like an idiot.. But I cannot figure it out.

     

    Here is the HTML form (index.php?page=apply)

     

    <form id="apply" name="apply" method="post" action="index.php?page=apply">
    		    <h1><?php echo $clan_tag; ?> Application</h1>
                      <p>Thank you for expressing interest in joining <?php echo $clan_name; ?>!  We have a simple application form we'd like you to fill out in order for us to get to know the basics about you!  We wish you the best of luck in your application process -- we look forward to speaking with you soon! </p>
                      <hr />
                      <p align="center"><strong>Name</strong><br />
                      <em>Please give your game handle, or name you will be using as a member of this clan.</em><br />
                      <input type="text" name="name" id="name" />
                      </p>
                      <p align="center"><strong>Informal Name</strong><br />
                        <em>What other name can we call you.  This can be your first name, shortened version of your firstname, etc. (e.g. "Bill")</em><br />
                        <label for="i_name"></label>
                        <input type="text" name="i_name" id="i_name" />
                      </p>
    <p align="center"><strong>Registered Username</strong><br />
      <em>Please provide your username on the forums. Registering on the forums is a requirement to be a member of the clan.</em><br />
      <input type="text" name="username" id="username" />
    </p>
                      <p align="center"><strong>Steam Username</strong><br />
                        <input type="text" name="steam" id="steam" />
                      </p>
                      <p align="center"><strong>Xfire Username</strong><br />
                        <input type="text" name="xfire" id="xfire" />
                      </p>
                      <p align="center"><strong>E-Mail Address</strong><em><br />
                      We may periodically send you an e-mail. Additionally, you will receive application status (if you are accepted or denied) to this e-mail. Please provide a legitimate e-mail address.</em><br />
                      <input name="email" type="email" id="email" />
                      </p>
                      <p align="center"><strong>Games you play</strong><em><br />
                      Please list all games you play (especially games supported by <?php echo $clan_name; ?>).</em><br />
                      <textarea name="games" id="games" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>Age</strong><br />
                      <em>You must be at least 15 years of age to join</em><br />
                      <input type="text" name="age" id="age" />
                      </p>
                      <p align="center"><strong>Location</strong><em><br />
                      Where are you from? Please provide a country and a region (e.g. USA: Eastern Coast). This helps us decide where to get servers, etc)</em><br />
                      <input type="text" name="location" id="location" />
                      </p>
                      <p align="center"><strong>Do you have a microphone?</strong><br />
                      <em>We use TeamSpeak 3 for a lot of our in-game experience.</em> <em>Do you have a microphone so that you too can be a part of this experience?</em><br />
                      <select name="microphone" id="microphone">
                        <option value="0" selected= "selected">Please Answer</option>
                        <option value="1">Yes I do</option>
                        <option value="2">No, I do not.  But I am willing to purchase one</option>
                        <option value="3">No, I do not.  I am not willing to get one</option>
                      </select>
                      </p>
                      <p align="center"><strong>Why do you want to join <?php echo $clan_tag; ?>?</strong><br />
                      <em>Tell us about why you would like to join this clan?  We are looking for serious individuals, so the more time and effort you put into this will help enhance your application.</em><br />
                      <label for="why_join"></label>
                      <textarea name="why_join" id="why_join" cols="90" rows="10"></textarea>
                      </p>
                      <p align="center"><strong>Please tell us a little bit about your previous clan history.</strong><br />
                        <em>Tell us your history. What clans have you been in?  What time period did you spend in that clan?  What is the reason you left/kicked out of that clan?  What rank/responsibilities did you hold in that clan? </em><br />
                        <label for="clan_history"></label>
                          <textarea name="clan_history" id="clan_history" cols="90" rows="5"></textarea>
                      </p>
                      <p align="center"><strong>How did you find out about us?</strong><br />
                        <select name="recruit_style" id="recruit_style">
                          <option value="0" selected="selected">Please Answer</option>
                          <option value="1">Recruited by a member</option>
                          <option value="2">Top 100 clans</option>
                          <option value="3">Search Engine (Google, Yahoo, etc)</option>
                          <option value="4">Other (please describe)</option>
                        </select>
                      </p>
                      <p align="center"><strong>Who recruited you?</strong><br />
                        <em>If you selected that someone recruited you above, please give that person's name.  We pride community, so if a member of ours is responsible for bringing you here, we want to give them credit!</em><br />
                        <label for="recruit"></label>
                        <input name="recruit" type="text" id="recruit" value="Self recruit" />
                        <input type="hidden" name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
                        <input type='hidden' id='time' name='time' value='<?php echo $_SERVER['REQUEST_TIME']; ?>'>
                      </p>
                      <p align="center">
                        <input type="submit" name="submit" id="submit" value="Send Application" />
                      </p>
    		    </form>

     

    And here is the PHP processing on the same page

     

     <?php
    
    			if ($_POST['submit'])
    			{
    				$application_id = substr(number_format(time() * rand(),0,'',''),0,6);
    									include ("include.php");
    
    				$timestamp = $_SERVER['REQUEST_TIME'];
    				$timestamp2 = $_POST['time'];					
    				$site_username = $_POST['username'];
    				$name = htmlspecialchars($_POST['name']);
    
    				 $get_site_id = mysql_query ("SELECT * FROM ws_Lw9_user WHERE username = '$site_username'", $webspell_link) or die(mysql_error());
    				 while($get_s_id = mysql_fetch_array($get_site_id))
    				 { 
    
    $site_id = $get_s_id['userID'];
    }  					 
    
    
    
    				$app_application = mysql_query("INSERT INTO applications 
    (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 
    
    if (isset($app_application)) { echo "good"; }
    			}
    
    			elseif (!isset($app_application))
    			{
    				echo "please submit";
    			}
    
    			?>

     

    I will also note, the checks I have at the bottom, do not even apply after submitting.    It doesn't echo good (so the query is not set), nor "please submit" (so the query isn't the opposite of being set, either  :confused:)..  "Please submit" only echoes before I submit -- which I want it to do.

     

     

    I should add, you will find a lot of variables that aren't being used.. That's mostly due to something I tried to modify or otherwise fix, but was unsuccessful.  Once this issue is fixed, these other variables will be added to.

     

    Any help/suggestions?

  13. After some time on Google, I found some users that were having the same problem.

     

    Not getting any errors with the INSERT INTO function, but no row was added.  I even tried to remake the registration page, and gave a die message to appear when successful.

     

    include ("db.php"); // database connection
    $register_new = "INSERT INTO `users` VALUES ('','$username','$password','$xfire','$ip','0')";
    	}
    
    	die ("You have been successfully registered!");

      I get the success message, but nothing is actually inserted into the table.

     

    I deleted the table and recreatedit , same thing -- no new data inserted.

     

    Maybe this new bit of info helps if anyone has had problems with this before?

     

     

  14. Hey everyone, I am in a bit of a bind... again.

     

    I have been working on this project for a few weeks now, and I have a user registration that accompanies a log in script.  Well, it was working -- could register new users, and everything.. Well tonight, I went back to test the page again (I don't remember why), and it was not adding the new user account.

     

    I have the script set up to go to another page that runs a series of checks, and if successful has a mysql script to insert a new row into the database.  I also have a series of alert boxes (using Javascript) that would tell the user the status of things.

     

    Here is the registration form code (found on the following page:  http://www.pwnstargaming.com/doc/wos/register.php)

     

    <form id="register" name="register" method="post" action="registerprocess.php">
              <hr size="5" />
              <p align="left">            If you are interested in holding an account on this system, please fill out the following form!<br />
                <br />
                <em>For the confirmation, please type in, '<strong>pwnstardoc</strong>' (without the quote marks) </em><br />
                  <br />
                <input id="ip" name="ip"  value='<?php echo $_SERVER["REMOTE_ADDR"]?>' type='hidden'>
                <strong>Username:</strong>
                <input type="text" name="username" />
              </p>
              <p align="left"><strong>Desired Password:</strong>
                <input type="password" name="password" />
                <br />
                <br />
                <strong>Repeat Password:</strong>
                <input type="password" name="password2" />
              </p>
              <p align="left"><strong>Xfire Address:</strong>
                <input type="text" name="xfire" /></p>
              <p align="left"><strong>Anti-Spam Confirmation:</strong>
              <input type="text" name="confirmation" /></p>
              <p align="left">
                <input type="submit" name="submit" id="submit" value="Submit Registration" />
                <br />
              <em>Disclaimer:  IP Address will be collected upon successful registration. </em></p>
            </form>

     

    And the processing script code

     

    <?php
    
    ini_set('display_errors',1);
    error_reporting(E_ALL|E_STRICT);
    
    include ("db.php");
    
    if ($_POST['submit'] == "Submit Registration")
    
    {
    
    if ($_POST['password'] == $_POST['password2'])
    {
    // if passwords match
    
    if ($_POST['confirmation'] == "pwnstardoc")
    {
    $insert_user="INSERT INTO users (username, password, ip, xfire)
    VALUES
    ('$_POST[username]','$_POST[password]','$_POST[ip]',$_POST[xfire])" or die ("not submitted");
    
    if (mysql_query($insert_user)) 
    {
    echo "
       <script type='text/javascript'>
           alert(\"You have been successfully registered!  You will be redirected to the log-in page now.\");
       </script>
    	";
    
    	echo "<meta HTTP-EQUIV='REFRESH' content='0; url=login.php'>"; 
    
    }
    else
    {
    echo "
       <script type='text/javascript'>
           alert(\Registration failed!  Please go back and try again!\");
       </script>
    	";
    
    	/*echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerfail.php'>"; */
    }  
    
    }
    else
    {
    /*echo "confirmation bad"; */
    
    echo "
       <script type='text/javascript'>
           alert(\"Confirmation code was not entered correctly!  Please go back and re-read the instructions, and enter the code correctly. Please click OK to go back to the registration form!\");
       </script>
    	";
    
    echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registercode.php'>"; 
    }
    
    
    }
    else
    {
    /*echo "password bad"; */
    
    echo "
       <script type='text/javascript'>
           alert(\"Your desired passwords did not match one another!  Please go back and carefully re-type your desired passwords. Please click OK to go back to the registration form!\");
       </script>
    	";
    
    echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerpass.php'>"; 
    }
    
    }
    
    
    ?>

     

    Currently the page is just going to the processing page as a blank page (even with error reporting turned on).  It doesn't even do a pop up box - like it used to.

     

    The part of the code that has '/*echo "<meta HTTP-EQUIV='REFRESH' content='0; url=registerfail.php'>"; */' is where the issue is (that else statement)..  I changed most of my refreshes to dead pages to see where it failed -- ie.  registerfail.php does not exist.  However, if I take that part of the code out of comment lines, and try and register, it redirects to this page.  So I know that it is failing to execute the mysql $insert_user query (from the if statement above).  However, it doesn't even throw the popup box from that section of the code.....

     

    Does anyone have any pointers on what to do?  I do not believe I have done anything since the time this page worked and now, with it not working.  I even added a die() at the end of the query to see if it would give me an error, it doesn't.

     

    I am lost....

  15. Changing it to implode fixed the error, I now get no error!

     

    However, when I check was submitted, the value submitted into the database is simply just "array"

     

    Here is my processing code again.

    <?
    
    include 'db.php';
    
    mysql_select_db('skylers_training');
    
    if (isset($_POST['submit']))
    {
    $project_lists = isset($_POST['project_list']) ? $_POST['project_list'] : array();  # this is called a ternary operator
    
    if (is_array($project_lists) && count($project_lists) > 0)
    {
    
    foreach($project_lists as $list);	
    
    
    }	
    
    
    else
    {
    	echo "Something went wrong.  Take a look at what was posted: <br />";
    	print_r($_POST);
    	exit;
    }
    
    // Assume $project_lists array has been validated and looks like this:
    $project_lists = array($_POST['project_list']);
    
    // Make it into a comma separated list
    $project_lists_string = implode(',', $project_lists); 	
    
    
    $reginsert = mysql_query("INSERT INTO registrations (name, age, username, email, skype, timezone, discussion, meaning, whyjoin, team_purpose, achieve, gyc_change, project_list) VALUES('$_POST[name]','$_POST[age]','$_POST[username]','$_POST[email]','$_POST[skype]','$_POST[timezone]','$_POST[discussion]','$_POST[meaning]','$_POST[whyjoin]','$_POST[team_purpose]','$_POST[achieve]','$_POST[gyc_change]','$project_lists_string')") or die(mysql_error());
    
    
    
    
    
    /*if (!mysql_query($reginterest))
      {
      die('Error: ' . mysql_error()); 
    
    }*/
    echo "
       <script type='text/javascript'>
           alert(\"Your Registration of Interest has been successfully submitted.  Please allow for up to 30 days to hear back from us.\");
       </script>
    	";
    mysql_close();
    
    
    }
    
    ?>
    

     

     

     

    [attachment deleted by admin]

  16. When I try doing what you gave me, I get the error: 

     

    Warning: explode() expects parameter 2 to be string, array given in /home/skylers/public_html/trainingmodsite/regsubmit.php on line 31

     

    I will post all the code I have so you can see if there is something I am doing wrong, right, or what not.

     

    Here is the code for the HTML form (starting at the checkbox section).

      <p><strong>Do you have an idea about the projects you might be interested in?</strong><br />
        <em>Please let us know if there is a specific part of the site that you are interested in contributing towards.</em><br />
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="chat"/> 
      Chat Project (age 18+ requirement)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="forums"/>
      Forums Project (age 18+ requirement)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="content"/>
      Content/Editorial Project (postcasts, blogging, etc.)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="technology"  />
      Technology Project</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="marketing"/>
      Marketing, Promotions and Publicity</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="designartwork"/>
      Design and Artwork</label>
      </p>
      <p>
        <input type="submit" name="submit" id="submit" value="Submit" />
      </p>
    </form>
    
    

     

     

    Here is the processing file, regsubmit.php

    <?
    
    include 'db.php';
    
    mysql_select_db('skylers_training');
    
    if (isset($_POST['submit']))
    {
    $project_lists = isset($_POST['project_list']) ? $_POST['project_list'] : array();  # this is called a ternary operator
    
    if (is_array($project_lists) && count($project_lists) > 0)
    {
    
    foreach($project_lists as $list);	
    
    
    }	
    
    
    else
    {
    	echo "Something went wrong.  Take a look at what was posted: <br />";
    	print_r($_POST);
    	exit;
    }
    
    // Assume $project_lists array has been validated and looks like this:
    $project_lists = array('chat', 'forums', 'content', 'technology', 'marketing', 'designartwork');
    
    // Make it into a comma separated list
    $project_lists_string = explode(',', $project_lists); 	
    
    
    $reginsert = mysql_query("INSERT INTO registrations (name, age, username, email, skype, timezone, discussion, meaning, whyjoin, team_purpose, achieve, gyc_change, project_list) VALUES('$_POST[name]','$_POST[age]','$_POST[username]','$_POST[email]','$_POST[skype]','$_POST[timezone]','$_POST[discussion]','$_POST[meaning]','$_POST[whyjoin]','$_POST[team_purpose]','$_POST[achieve]','$_POST[gyc_change]','$project_lists_string')") or die(mysql_error());
    
    
    
    
    
    /*if (!mysql_query($reginterest))
      {
      die('Error: ' . mysql_error()); 
    
    }*/
    echo "
       <script type='text/javascript'>
           alert(\"Your Registration of Interest has been successfully submitted.  Please allow for up to 30 days to hear back from us.\");
       </script>
    	";
    mysql_close();
    
    
    }
    
    ?>
    
    

     

    I appreciate the help I have been given so far.  I'm still relatively new to PHP (not taken a class in my life -- trying to learn things by myself).

     

    Hope all the code can help you guys figure out why the error message and provide a fix for it not submitting the data properly.

     

    Here is what I want the PHPMyAdmin to look like on a successful submission.

     

     

     

     

    [attachment deleted by admin]

  17. That fixed the error, but it still isn't submitting all the checkboxes to the database, only submitting the last one checked.

     

    So if I check Chat, Forums, and Technology -- only technology is actually submitted.

     

    In an ideal world, if I checked the 3 checkboxes, they would all get submitted together, just like (with commas separating them):

     

    chat, forums, tech

     

    I could make separate database rows for each project, but I was trying to be coding efficient and process them all together instead of separately.

     

    Any more help would be appreciated.

  18. Hey all..

     

    I have been messing around with some code with a form that has checkboxes on them, and the option of selecting more than one checkbox to submit to the database.  However, I keep getting the error," Warning: Invalid argument supplied for foreach() in (mydirectory)".

     

    I have followed many tutorials and I don't see anything I am doing differently that they are, so I'm sure this is a simple fix, of something I am overlooking, or I am just horrible at this (new person).

     

    Here is the snippet of the HTML code for the checkboxes.

    <label>
      <input type="checkbox" name="project_list[]" value="chat"/> 
      Chat Project (age 18+ requirement)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="forums"/>
      Forums Project (age 18+ requirement)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="content"/>
      Content/Editorial Project (postcasts, blogging, etc.)</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="technology"  />
      Technology Project</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="marketing"/>
      Marketing, Promotions and Publicity</label>
    <br />
    <label>
      <input type="checkbox" name="project_list[]" value="designartwork"/>
      Design and Artwork</label>

     

    Here is the PHP code that I am using to do this.

    include 'db.php';
    
    mysql_select_db('skylers_training');
    
    if($_POST['submit'])
    
    {
    $project_lists = $_POST['project_list'];
    
    foreach($project_lists as $list); //This is the line the code is getting the error on.
    
    

     

    And the section of the INSERT MYSQL CODE for this part.

    $reginsert = mysql_query("INSERT INTO  ... // the rest of the code (that works fine) follows this.
    
    '$list' // This is the line that is supposed to send data from the checklists to the database. 
    
    
    

     

     

    When I submit the form, in addition to the error, nothing is submitted to the database table for the list (everything else works fine).

     

    Any insight into this, would be appreciated.

     

    Thanks!

     

     

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