Jump to content

HTML Form not inserting to mysql... no errors reported


Doc20

Recommended Posts

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?

Link to comment
Share on other sites

  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Why did you change the information given?  $app_application is not what Pik wanted you to test for.

Link to comment
Share on other sites

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 ().

 

 

Link to comment
Share on other sites

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 ?

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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; 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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] =>

Link to comment
Share on other sites

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] => 

Link to comment
Share on other sites

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 ;

Link to comment
Share on other sites

When you execute this code, it can be shown the full structure of table `applicaions` from db name `doggysty_recruitment`.

There is something wrong, double check again.

$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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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