Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Require email on database submission form

    What code do I use to have a person type data on to a form and submit it so the data goes into a database but if they don't type an email into the email textbox, the form won't let the person submit the form?

  • #2
    New Coder
    Join Date
    Mar 2010
    Posts
    12
    Thanks
    4
    Thanked 0 Times in 0 Posts
    basically use a if statement with an isset fuction

    PHP Code:
    <?php
    if(isset($_POST[email])){
    //code to send it to database
    }
    else{
    //display form
    }
    ?>

  • #3
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Quote Originally Posted by stevey17 View Post
    basically use a if statement with an isset fuction

    PHP Code:
    <?php
    if(isset($_POST[email])){
    //code to send it to database
    }
    else{
    //display form
    }
    ?>
    stevey17 that wouldnt validate that the user inputted an email they could just put hello and it would still send the data

    what you would need to do crazykid is this:
    PHP Code:
    <?php
    if(isset($_POST['email']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$_POST['email'])) {
    //code to send it to database
    }
    else{
    //display form
    }
    ?>

  • #4
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Is this the code that sends the email to the database?

    Code:
    if(isset($_POST['email']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) {
    Is this the code for the display form?

    Code:
    else{
    
    }
    This is the code I got for the email input textbox...it displays the textbox and sends the data to the database:

    Code:
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
    This is the code I got to match the data inputted with the database variable:

    Code:
    $quest_ipaddress=$_SERVER['IPAddress'];
    Any way of merging the codes together with the codes you gave me?
    Last edited by crazykid; 03-24-2010 at 02:57 AM.

  • #5
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    PHP Code:
    <?php
    if(isset($_POST['Email']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$_POST['Email'])) {
    // this is where you send the data to the database
    }else{
    // this is where you put your form for the user to use
    }
    ?>

  • #6
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Does this code look good:

    Code:
    <?php
    if(isset($_POST['IPAddress']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['IPAddress'])) {
    // this is where you send the data to the database
    }else{
    ?>
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
    <?
    // this is where you put your form for the user to use
    }
    ?>
    Problem is when I test it and put in my email, the code I use to send people back if they didn't put in their email still doesn't let me go through.

  • #7
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Another way would be this.

    PHP Code:
    if (EMPTY($_post['email'])) {
    //Email is empty
    }
    else {
    //Continue processing

    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #8
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Quote Originally Posted by crazykid View Post
    Does this code look good:

    Code:
    <?php
    if(isset($_POST['IPAddress']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['IPAddress'])) {
    // this is where you send the data to the database
    }else{
    ?>
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
    <?
    // this is where you put your form for the user to use
    }
    ?>
    Problem is when I test it and put in my email, the code I use to send people back if they didn't put in their email still doesn't let me go through.
    No you need to write this:
    Code:
    <?php
    if(isset($_POST['IPAddress']) && isset($_POST['Email']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['Email'])) {
    // this is where you send the data to the database
    }else{
    ?>
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
    <?
    // this is where you put your form for the user to use
    }
    ?>
    EDIT:
    And the whole form needs to go where the td tag is.

  • #9
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    This is what my whole file looks like:

    Code:
    <? include "/home1/sparkonl/public_html/fiesta/questdb/core_quest_functions.php";
    ?>
    
    
    
    		<?
    		$quest_category = $_POST['Category'];
    		$quest_name = $_POST['Name'];
    		   $quest_level = $_POST['Level'];
    		$quest_location = $_POST['Location'];
         		   $quest_npc = $_POST['NPC'];
    		$quest_objective = $_POST['Objective'];
    		$quest_procedure = $_POST['Procedure'];
    		$quest_rewards = $_POST['Rewards'];
         		   $quest_pre = $_POST['Prereq'];
    		$quest_repeatable = $_POST['Repeatable'];
                    $quest_ipaddress=$_SERVER['IPAddress']; 
    
    
    
    
    		$error = '0';
    //If they are all blank we just say to compose a message
            if(!$quest_category AND !$quest_name)
                {
                ?>
                <p><b><center>Please complete the quest information<center></b></p>
                <br>
                <?
                }
            
            //Since this form was partially filled out we need to return an error message
            else
                {
    
                //If the variable error is not set to zero, we have a problem and should show the error message
                if (!$quest_name)
                    {
                    $error = 'You must enter the quests name';
                    }
                if (!$quest_email)
                    {
                    $error = 'You must enter your email address';
                    }
    
                if($error != '0')
                    {
                    echo "<p>$error</p><br>";
                    }
               
                //There are no errors so far which means the form is completely filled out    
                else
                        {
    			    $category_check = $quest_category;
                    if($category_check > '0')
    				{
    
                        
    
                     //add quest into the database
      mysql_query("INSERT INTO quest (Category, Name, Level, Location, NPC, Objective, `Procedure`, Rewards, Prereq, Repeatable, Email, IPAddress) VALUES('$quest_category',  '$quest_name', '$quest_level', '$quest_location', '$quest_npc', '$quest_objective', '$quest_procedure', '$quest_rewards', '$quest_pre', '$quest_repeatable', '$quest_email', '$quest_ipaddress')") or die (mysql_error());		
      
    if ($quest_category = 1) {
                $category_name ="quest1-10.php";
                }
    			elseif ($quest_category = 2) {
                $category_name ="quest11-20.php";
                }
    			elseif ($quest_category = 3) {
                $category_name ="quest21-30.php";
                }
    			elseif ($quest_category = 4) {
                $category_name ="quest31-40.php";
                }
    			elseif ($quest_category = 5) {
                $category_name ="quest41-50.php";
                }
    			elseif ($quest_category = 6) {
                $category_name ="quest51-60.php";
                }
    			elseif ($quest_category = 7) {
                $category_name ="quest61-70.php";
                }
    			elseif ($quest_category = 8) {
                $category_name ="quest71-80.php";
                }
    			elseif ($quest_category = 9) {
                $category_name ="quest81-90.php";
                }
    			elseif ($quest_category = 10) {
                $category_name ="quest91-100.php";
                }
    			elseif ($quest_category = 11) {
                $category_name ="quest100+.php";
                }
    			elseif ($quest_category = 12) {
                $category_name ="questkq.php";
                }
    		else {
    		echo ERROR;
    		}
    	
    	$link_name = str_replace(" ", "_", "$quest_name");	
    	$quest_link = "http://fiestavault.sparkonline.net/quest/$category_name#$link_name";
    	mysql_query("INSERT INTO master (Name, Link, Namelink) VALUES('$quest_name', '$quest_link', '$link_name')") or die (mysql_error());							
    
     							 
                            //Let the user know everything went ok.
                            echo "<center><p><b>You have successfully submitted an quest!</b></p></center><br>";
                            }
      //Since they are trying to send messages faster than every 15 seconds, give them an error message    
                        }         
                    //If they mis spelled or, made up a username, then give an error message telling them its wrong.
                    }
                
            //Since we may have set the error variable to something while trying to send the message, we need another error check
            if($error != '0')
                {
                echo "<p>$error</p><br>";
                }
                
            else
                {
                //Here's the form for the input
                ?> <center>
                <form name="send" method="post" action="submitquest.php">
                <table width="100%">
                  <tr>
                    <td width="150px" align="center" valign="top"><p><b>Quest Category</b></p> <SELECT NAME="Category">
    <OPTION VALUE="">Select a category</OPTION>
    <OPTION VALUE=""></OPTION>
    	<OPTION VALUE="1">Level 1-10</OPTION>
    	<OPTION VALUE="2">Level 11-20</OPTION>
    	<OPTION VALUE="3">Level 21-30</OPTION>
    	<OPTION VALUE="4">Level 31-40</OPTION>
    	<OPTION VALUE="5">Level 41-50</OPTION>
    	<OPTION VALUE="6">Level 51-60</OPTION>
    	<OPTION VALUE="7">Level 61-70</OPTION>
    	<OPTION VALUE="8">Level 71-80</OPTION>
    	<OPTION VALUE="9">Level 81-90</OPTION>
    	<OPTION VALUE="10">Level 90-100</OPTION>
    	<OPTION VALUE="11">Level 100+</OPTION>
    	<OPTION VALUE="12">Kingdom Quest</OPTION>
    </SELECT></td></tr>
    <tr><td>
    <center><b>Quest Information</b></center>
    </td>
                  </tr>
                 </table>
    			 <table width="100%">
                  <tr>
    			  <td width="50%" align="left" valign="top"><p>Quest Name: <input type="text" name="Name" value="" size="20" maxlength="255"/></p></td>
    			  <td width="50%" align="left" valign="top"><p>Starting Level: <input type="text" name="Level" value="" size="5" maxlength="5"/> </p></td>
                  </tr>
                   <tr>
    			   <td width="50%" align="left" valign="top"><p>Starting Location: <input type="text" name="Location" value="" size="20" maxlength="255"/></p></td>
    			   <td width="50%" align="left" valign="top"><p>Starting NPC: <input type="text" name="NPC" value="" size="20" maxlength="255"/> </p></td>
                  </tr> 
    			  <tr>
    			  <td width="50%" align="left" valign="top"><p>Objective:<textarea name="Objective" type="text" id="Objective" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
    			  <td width="50%" align="left" valign="top"><p>Procedure:<textarea name="Procedure" type="text" id="Procedure" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
                  </tr>
    			  <tr>
    			  <td width="50%" align="left" valign="top"><p>Rewards:<textarea name="Rewards" type="text" id="Rewards" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
    			  <td width="50%" align="left" valign="top"><p>Pre-Requisites:<input type="text" name="Pre" value="" size="20" maxlength="255"/> </p></td>
                  </tr>
    			  <tr>
    			<td width="100%" align="left" valign="top">Repeatable: No<input type="RADIO" name="Repeatable" value="No" checked> Yes<input type="RADIO" name="Repeatable" value="Yes"></td>
    			</tr>
    			  <tr>
    <?php
    if(isset($_POST['IPAddress']) && isset($_POST['Email']) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['Email'])) {
    // this is where you send the data to the database
    }else{
    ?>
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
    <?
    // this is where you put your form for the user to use
    }
    ?> 
    			</tr>
                  <tr>  
                    <td><input type="reset" value="Reset" /></td>
                    <td><input type="submit" name="Submit" value="Submit quest"></td>
                  </tr>
                </table>
                </center>
                </form>
    		    <?
                }  
        ?>
    And when I input my email address I still get a message telling me that I need to enter an email address.

  • #10
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    This is how you should do it with the whole form inside the else statement:
    PHP Code:
    [FONT=Arial]<?php[/FONT]
    [
    FONT=Arial]if(isset($_POST['IPAddress']) && isset($_POST['Email']) && preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" $_POST['Email'])) {[/FONT]
    [
    FONT=Arial]// this is where you send the data to the database[/FONT]
    [FONT=Arial]}else{[/FONT]
    [
    FONT=Arial]?>[/FONT]
    [FONT=Arial]            <form name="send" method="post" action="submitquest.php">[/FONT]
    [FONT=Arial]            <table width="100%">[/FONT]
    [FONT=Arial]              <tr>[/FONT]
    [FONT=Arial]                <td width="150px" align="center" valign="top"><p><b>Quest Category</b></p> <SELECT NAME="Category">[/FONT]
    [FONT=Arial]<OPTION VALUE="">Select a category</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE=""></OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="1">Level 1-10</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="2">Level 11-20</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="3">Level 21-30</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="4">Level 31-40</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="5">Level 41-50</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="6">Level 51-60</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="7">Level 61-70</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="8">Level 71-80</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="9">Level 81-90</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="10">Level 90-100</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="11">Level 100+</OPTION>[/FONT]
    [FONT=Arial]<OPTION VALUE="12">Kingdom Quest</OPTION>[/FONT]
    [FONT=Arial]</SELECT></td></tr>[/FONT]
    [FONT=Arial]<tr><td>[/FONT]
    [FONT=Arial]<center><b>Quest Information</b></center>[/FONT]
    [FONT=Arial]</td>[/FONT]
    [FONT=Arial]              </tr>[/FONT]
    [FONT=Arial]             </table>[/FONT]
    [FONT=Arial]<table width="100%">[/FONT]
    [FONT=Arial]              <tr>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Quest Name: <input type="text" name="Name" value="" size="20" maxlength="255"/></p></td>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Starting Level: <input type="text" name="Level" value="" size="5" maxlength="5"/> </p></td>[/FONT]
    [FONT=Arial]              </tr>[/FONT]
    [FONT=Arial]               <tr>[/FONT]
    [FONT=Arial]   <td width="50%" align="left" valign="top"><p>Starting Location: <input type="text" name="Location" value="" size="20" maxlength="255"/></p></td>[/FONT]
    [FONT=Arial]   <td width="50%" align="left" valign="top"><p>Starting NPC: <input type="text" name="NPC" value="" size="20" maxlength="255"/> </p></td>[/FONT]
    [FONT=Arial]              </tr> [/FONT]
    [FONT=Arial]  <tr>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Objective:<textarea name="Objective" type="text" id="Objective" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Procedure:<textarea name="Procedure" type="text" id="Procedure" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>[/FONT]
    [FONT=Arial]              </tr>[/FONT]
    [FONT=Arial]  <tr>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Rewards:<textarea name="Rewards" type="text" id="Rewards" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>[/FONT]
    [FONT=Arial]  <td width="50%" align="left" valign="top"><p>Pre-Requisites:<input type="text" name="Pre" value="" size="20" maxlength="255"/> </p></td>[/FONT]
    [FONT=Arial]              </tr>[/FONT]
    [FONT=Arial]  <tr>[/FONT]
    [FONT=Arial]<td width="100%" align="left" valign="top">Repeatable: No<input type="RADIO" name="Repeatable" value="No" checked> Yes<input type="RADIO" name="Repeatable" value="Yes"></td>[/FONT]
    [FONT=Arial]</tr>[/FONT]
    [FONT=Arial]  <tr>[/FONT]
    [FONT=Arial]<td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>[/FONT]
    [FONT=Arial] </tr>[/FONT]
    [FONT=Arial]              <tr>  [/FONT]
    [FONT=Arial]                <td><input type="reset" value="Reset" /></td>[/FONT]
    [FONT=Arial]                <td><input type="submit" name="Submit" value="Submit quest"></td>[/FONT]
    [FONT=Arial]              </tr>[/FONT]
    [FONT=Arial]            </table>[/FONT]
    [FONT=Arial]            </center>[/FONT]
    [FONT=Arial]            </form>[/FONT]
    [FONT=Arial]<? ?> [/FONT]
    [FONT=Arial][/FONT]
    EDIT:
    you dont have email set in these:
    PHP Code:
    $quest_category $_POST['Category'];
    $quest_name $_POST['Name'];
    $quest_level $_POST['Level'];
    $quest_location $_POST['Location'];
    $quest_npc $_POST['NPC'];
    $quest_objective $_POST['Objective'];
    $quest_procedure $_POST['Procedure'];
    $quest_rewards $_POST['Rewards'];
    $quest_pre $_POST['Prereq'];
    $quest_repeatable $_POST['Repeatable'];
    $quest_ipaddress   =$_SERVER['IPAddress']; 
    Last edited by DJCMBear; 03-24-2010 at 03:31 AM.

  • #11
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    http://fiesta.sparkonline.net/questd...ubmitquest.php

    Yea, I run a website based on an online game and the form allows a user to submit information about a quest into any one of the categories in the drop-down menu. I want to put in the email verification because I'm going to do an event for people and I need email verification.

    So where would those variables go?

  • #12
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Quote Originally Posted by crazykid View Post
    So where would those variables go?
    They are your vars but i was saying you are checking for $quest_email when you haven't sent it in that var list.

  • #13
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Yea, I was going to use this as the var for the email input:

    Code:
    $quest_ipaddress=$_SERVER['IPAddress'];
    But I needed that code you posted up the prevents random stuff from being put in as an email. How would I merge your code with the code I had originally?

  • #14
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Quote Originally Posted by crazykid View Post
    Yea, I was going to use this as the var for the email input:

    Code:
    $quest_ipaddress=$_SERVER['IPAddress'];
    But I needed that code you posted up the prevents random stuff from being put in as an email. How would I merge your code with the code I had originally?
    1. Why use an email input is your going to call a server ip code that defetes the object abit.
    2. Your still checking for $quest_email in your code when you dont have a var for it thats why your getting the email error.
    3. Checking the inputted email is what you asked for so I gave you the code to do it so the users ip address cant be used seeing as its not an email address.
    And to merge both together my code checks the email input nothing else so use that for $_POST['Email'] and nothing else.
    EDIT:
    try this:
    PHP Code:
    <? include "/home1/sparkonl/public_html/fiesta/questdb/core_quest_functions.php";
    ?>
     
      <?
      $quest_category 
    $_POST['Category'];
                    
    $quest_email=$_POST['Email'];
      
    $quest_name $_POST['Name'];
      
    $quest_level $_POST['Level'];
      
    $quest_location $_POST['Location'];
           
    $quest_npc $_POST['NPC'];
      
    $quest_objective $_POST['Objective'];
      
    $quest_procedure $_POST['Procedure'];
      
    $quest_rewards $_POST['Rewards'];
           
    $quest_pre $_POST['Prereq'];
      
    $quest_repeatable $_POST['Repeatable'];
                    
    $quest_ipaddress=$_SERVER['IPAddress'];
                    
    $quest_email=$_POST['Email'];
      
    $error '0';
    //If they are all blank we just say to compose a message
            
    if(!$quest_category AND !$quest_name)
                {
                
    ?>
                <p><b><center>Please complete the quest information<center></b></p>
                <br>
                <?
                
    }
            
            
    //Since this form was partially filled out we need to return an error message
            
    else
                {
                
    //If the variable error is not set to zero, we have a problem and should show the error message
                
    if (!$quest_name)
                    {
                    
    $error 'You must enter the quests name';
                    }
                if (!
    $quest_email)
                    {
                    
    $error 'You must enter your email address';
                    }
                if(
    $error != '0')
                    {
                    echo 
    "<p>$error</p><br>";
                    }
               
                
    //There are no errors so far which means the form is completely filled out    
                
    else
                        {
           
    $category_check $quest_category;
                    if(
    $category_check '0')
        { 
    if (
    $quest_category 1) {
                
    $category_name ="quest1-10.php";
                }
       elseif (
    $quest_category 2) {
                
    $category_name ="quest11-20.php";
                }
       elseif (
    $quest_category 3) {
                
    $category_name ="quest21-30.php";
                }
       elseif (
    $quest_category 4) {
                
    $category_name ="quest31-40.php";
                }
       elseif (
    $quest_category 5) {
                
    $category_name ="quest41-50.php";
                }
       elseif (
    $quest_category 6) {
                
    $category_name ="quest51-60.php";
                }
       elseif (
    $quest_category 7) {
                
    $category_name ="quest61-70.php";
                }
       elseif (
    $quest_category 8) {
                
    $category_name ="quest71-80.php";
                }
       elseif (
    $quest_category 9) {
                
    $category_name ="quest81-90.php";
                }
       elseif (
    $quest_category 10) {
                
    $category_name ="quest91-100.php";
                }
       elseif (
    $quest_category 11) {
                
    $category_name ="quest100+.php";
                }
       elseif (
    $quest_category 12) {
                
    $category_name ="questkq.php";
                }
      else {
      echo 
    ERROR;
      }
     
     
    $link_name str_replace(" ""_""$quest_name"); 
     
    $quest_link "http://fiestavault.sparkonline.net/quest/$category_name#$link_name";
     
    mysql_query("INSERT INTO master (Name, Link, Namelink) VALUES('$quest_name', '$quest_link', '$link_name')") or die (mysql_error());       
             
                            
    //Let the user know everything went ok.
                            
    echo "<center><p><b>You have successfully submitted an quest!</b></p></center><br>";
                            }
      
    //Since they are trying to send messages faster than every 15 seconds, give them an error message    
                        
    }         
                    
    //If they mis spelled or, made up a username, then give an error message telling them its wrong.
                    
    }
                
            
    //Since we may have set the error variable to something while trying to send the message, we need another error check
            
    if($error != '0')
                {
                echo 
    "<p>$error</p><br>";
                }else{
                
    //Here's the form for the input
                
    ?>
    <?php
    if(isset(isset($quest_email) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$quest_email)) {
    mysql_query("INSERT INTO quest (Category, Name, Level, Location, NPC, Objective, `Procedure`, Rewards, Prereq, Repeatable, Email, IPAddress) VALUES('$quest_category',  '$quest_name', '$quest_level', '$quest_location', '$quest_npc', '$quest_objective', '$quest_procedure', '$quest_rewards', '$quest_pre', '$quest_repeatable', '$quest_email', '$quest_ipaddress')") or die (mysql_error());  
    }else{
    ?>
     <center>
                <form name="send" method="post" action="submitquest.php">
                <table width="100%">
                  <tr>
                    <td width="150px" align="center" valign="top"><p><b>Quest Category</b></p> <SELECT NAME="Category">
    <OPTION VALUE="">Select a category</OPTION>
    <OPTION VALUE=""></OPTION>
     <OPTION VALUE="1">Level 1-10</OPTION>
     <OPTION VALUE="2">Level 11-20</OPTION>
     <OPTION VALUE="3">Level 21-30</OPTION>
     <OPTION VALUE="4">Level 31-40</OPTION>
     <OPTION VALUE="5">Level 41-50</OPTION>
     <OPTION VALUE="6">Level 51-60</OPTION>
     <OPTION VALUE="7">Level 61-70</OPTION>
     <OPTION VALUE="8">Level 71-80</OPTION>
     <OPTION VALUE="9">Level 81-90</OPTION>
     <OPTION VALUE="10">Level 90-100</OPTION>
     <OPTION VALUE="11">Level 100+</OPTION>
     <OPTION VALUE="12">Kingdom Quest</OPTION>
    </SELECT></td></tr>
    <tr><td>
    <center><b>Quest Information</b></center>
    </td>
                  </tr>
                 </table>
        <table width="100%">
                  <tr>
         <td width="50%" align="left" valign="top"><p>Quest Name: <input type="text" name="Name" value="" size="20" maxlength="255"/></p></td>
         <td width="50%" align="left" valign="top"><p>Starting Level: <input type="text" name="Level" value="" size="5" maxlength="5"/> </p></td>
                  </tr>
                   <tr>
          <td width="50%" align="left" valign="top"><p>Starting Location: <input type="text" name="Location" value="" size="20" maxlength="255"/></p></td>
          <td width="50%" align="left" valign="top"><p>Starting NPC: <input type="text" name="NPC" value="" size="20" maxlength="255"/> </p></td>
                  </tr> 
         <tr>
         <td width="50%" align="left" valign="top"><p>Objective:<textarea name="Objective" type="text" id="Objective" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
         <td width="50%" align="left" valign="top"><p>Procedure:<textarea name="Procedure" type="text" id="Procedure" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
                  </tr>
         <tr>
         <td width="50%" align="left" valign="top"><p>Rewards:<textarea name="Rewards" type="text" id="Rewards" value="" cols="30" rows="5" maxlength="500"></textarea></p></td>
         <td width="50%" align="left" valign="top"><p>Pre-Requisites:<input type="text" name="Pre" value="" size="20" maxlength="255"/> </p></td>
                  </tr>
         <tr>
       <td width="100%" align="left" valign="top">Repeatable: No<input type="RADIO" name="Repeatable" value="No" checked> Yes<input type="RADIO" name="Repeatable" value="Yes"></td>
       </tr>
         <tr>
    <td width="100%" align="right" valign="top">Email:<input type="text" name="Email" value="" size="20" maxlength="255"></td>
       </tr>
                  <tr>  
                    <td><input type="reset" value="Reset" /></td>
                    <td><input type="submit" name="Submit" value="Submit quest"></td>
                  </tr>
                </table>
                </form>
                </center>
    <? } } ?>
    Last edited by DJCMBear; 03-24-2010 at 04:17 AM.

  • #15
    Regular Coder
    Join Date
    Feb 2010
    Posts
    130
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Error:

    Parse error: syntax error, unexpected T_ISSET, expecting T_STRING or T_VARIABLE or '$' in /home1/sparkonl/public_html/fiesta/questdb/admin/submitquest.php on line 111
    Code:

    Code:
    if(isset(isset($quest_email) && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $quest_email)) {


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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