Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question 2 word name is going into database as 1 word

    Hi,

    When I try and insert a town with 2 words eg; Abbots Langley it only goes into the database as Abbots

    datafield is set at VarChar 250

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    More info required.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    sorry:


    Code:
    $RSTOWN = $_POST["'rsTown'"];
    	$rsGender = $_POST['rsGender'];
    	$RSUSER = $_POST['RSUSER'];
       $RSPASS = $_POST['RSPASS'];
    	$rsEmail = $_POST['rsEmail'];
    	$rsMobile = $_POST['rsMobile'];
    	$rsAge = $_POST['rsAge'];
    
       $sql = "INSERT INTO members_copy (RSTOWN, RSGENDER, RSUSER, RSPASS, RSEMAIL, RSMOBILE, RSAGE) VALUES ('$rsTown', '$rsGender', '$RSUSER', '$RSPASS', '$rsEmail', '$rsMobile', '$rsAge')";
    //echo $sql;
    mysql_query($sql);

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    What do you get for
    PHP Code:
    echo '<pre>';
    print_r($_POST);
    echo 
    '</pre>'
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    I can't echo anything out?!

  • #6
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    page is posting to itself:

    Code:
    <?php
    session_start();
    include_once("config.php");
    $ebits = ini_get('error_reporting');
    error_reporting($ebits ^ E_NOTICE);; 
    /*
    Login script:
    This script does the following:
    
    Checks that the user is NOT already logged in - if they are they
    are redirected to the members page by the 'checkLoggedIn()' function.
    
    Checks if the login form has been submitted - if so, the 'login' and
    'password' fields are checked to ensure they are of the correct format and length.
    If there are any problems here an error is added to the $messages array and
    then the script executes the 'doIndex()' function - this function basically
    outputs the main 'index' page for this script - ie the login form.
    
    If there are no problems with the previous step, the 'login' and 'password'
    field data is passed to the 'checkPass' function to check that an entry
    exists in the 'users' table for that login/password pair.
    If nothing is returned from the 'checkPass()' function, an error is
    added to the $messages array and the 'doIndex()' function is called as above.
    
    If a row of data is returned from the 'users' table, the data is passed to
    the 'cleanMemberSession()' function - which initializes session variables and
    logs the user in.  The user is then forwarded to the members page.
    
    If the form hasn't yet been submitted, then the 'doIndex()' function is called
    and the login page is displayed.
    */
    // Check user not logged in already:
    checkLoggedIn("no");
    
    // Page title:
    $title="Member Login Page";
    if (isset($_POST['RSUSER'])) 
    {
    $msg = 'You must enter a valid username/password';
    header('Location: register.php?msg='.$msg);
    }
    
    
    // if $submit variable set, login info submitted:
    if(isset($_POST["register"])) {
        // Your code here to handle a successful verification
    	$RSTOWN = $_POST["'rsTown'"];
    	$rsGender = $_POST['rsGender'];
    	$RSUSER = $_POST['RSUSER'];
       $RSPASS = $_POST['RSPASS'];
    	$rsEmail = $_POST['rsEmail'];
    	$rsMobile = $_POST['rsMobile'];
    	$rsAge = $_POST['rsAge'];
    	
    	$to = 'info@mypubspace.com, '.$rsEmail;
    
    //define the subject of the email
    $subject = 'Welcome '.$RSUSER.' to My Pub Space';
    
    // message
    $message = '
    <html>
    <head>
      <title>'.$subject.'</title>
    </head>
    <body>
      <table>
        <tr>
          <td>Name:</td>
    		<td>'.$RSUSER.'</td>
        </tr>
        <tr>
          <td>Email:</td>
    		<td>'.$rsEmail.'</td>
        </tr>
        <tr>
          <td>Town:</td>
    		<td>'.$rsTown.'</td>
        </tr>
    	 <tr>
          <td>Telephone:</td>
    		<td>'.$rsMobile.'</td>
        </tr>
    	 <tr>
          <td>DOB:</td>
    		<td>'.$rsAge.'</td>
        </tr>
    	 <tr>
          <td>Password:</td>
    		<td>'.$RSPASS.'</td>
        </tr>
      </table>
    </body>
    </html>
    ';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To:' .$to. "\r\n";
    $headers .= 'From:' .$rsEmail. "\r\n";
    
    
    // Mail it
    mail($to, $subject, $message, $headers);
    
       $sql = "INSERT INTO members_copy (RSTOWN, RSGENDER, RSUSER, RSPASS, RSEMAIL, RSMOBILE, RSAGE) VALUES ('$rsTown', '$rsGender', '$RSUSER', '$RSPASS', '$rsEmail', '$rsMobile', '$rsAge')";
    echo $sql;
    //mysql_query($sql);
    
    
    exit();
    
    
    
    $query1 = "SELECT * FROM members_copy WHERE RSUSER = '".$RSUSER."' AND RSPASS = '".$RSPASS."'";
    $result1 = mysql_query($query1);
    $row1 = mysql_fetch_array($result1);
    
    
    $_SESSION['USERID']=$row1['USERID'];
    $_SESSION['RSTOWN']=$row1['RSTOWN'];
    $_SESSION['RSEMAIL']=$row1['RSEMAIL'];
    $_SESSION['RSUSER']=$row1['RSUSER'];
    
    $pSQL = "INSERT INTO favepub_copy (USERID,PUBID)";
    $pSQL = $pSQL."SELECT ".$_SESSION['USERID'].", PUBID ";
    $pSQL = $pSQL."FROM pubs ";
    $pSQL = $pSQL."WHERE rsTown = '".$_SESSION["RSTOWN"]."'";
    
    mysql_query($pSQL);
    
    
    
    	// and finally forward user to members page (populating the session id in the URL):
    	header("Location: register.php");
    }
    
    
    // if $submit variable set, login info submitted:
    if(isset($_POST["login"])) {
    	//
    	// Check fields were filled in
    	//
    	// login must be between 4 and 15 chars containing alphanumeric chars only:
    	field_validator("RSUSER", $_POST["RSUSER"], "alphanumeric", 3, 15);
    	// password must be between 4 and 15 chars - any characters can be used:
    	field_validator("RSPASS", $_POST["RSPASS"], "string", 3, 15);
    
    	// if there are $messages, errors were found in validating form data
    	// show the index page (where the messages will be displayed):
    	if($messages){
    		doIndex();
    		// note we have to explicity 'exit' from the script, otherwise
    		// the lines below will be processed:
    		exit;
    	}
    
    	// OK if we got this far the form field data was of the right format;
    	// now check the user/pass pair match those stored in the db:
    	/*
    	If checkPass() is successful (ie the login and password are ok),
    	then $row contains an array of data containing the login name and
    	password of the user.
    	If checkPass() is unsuccessful however, $row will simply contain
    	the value 'false' - and so in that case an error message is
    	stored in the $messages array which will be displayed to the user.
    	*/
        if( !($row = checkPass($_POST["RSUSER"], $_POST["RSPASS"])) ) {
    		// login/passwd string not correct, create an error message:
            $messages[]="Incorrect login/password, try again";
        }
    if ($user = checkPass($_REQUEST['RSUSER'], $_REQUEST['RSPASS'])) {
      cleanMemberSession($user['RSUSER'], $user['RSPASS'], $user['USERID']);
    } else {
      echo('Login failed');
    }  
    	/*
    	If there are error $messages, errors were found in validating form data above.
    	Call the 'doIndex()' function (which displays the login form) and exit.
    	*/
    	if($messages){
    		doIndex();
    		exit;
    	}
    
    	/*
    	If we got to this point, there were no errors - start a session using the info
    	returned from the db:
    	*/
    	cleanMemberSession($row["RSUSER"], $row["RSPASS"]);
    
    	// and finally forward user to members page (populating the session id in the URL):
    	header("Location: main.php");
    } else {
    	// The login form wasn't filled out yet, display the login form for the user to fill in:
    	doIndex();
    }
    
    /*
    This function displays the default 'index' page for this script.  This consists of just a simple
    login form for the user to submit their username and password.
    */
    function doIndex() {
    	/*
    	Import the global $messages array.
    	If any errors were detected above, they will be stored in the $messages array:
    	*/
    	global $messages;
    
    	/*
    	also import the $title for the page - note you can normally just declare all globals on one line
    	- ie:
    	global $messages, $title;
    	*/
    	global $title;
    	}
    
    	// drop out of PHP mode to display the plain HTML:
    $query1 = "SELECT DISTINCT rsTown FROM pubs ORDER BY rsTown asc";
    	$result = mysql_query($query1);
    ?>
    <!doctype html>
    <html>
    <head>
    <title>List of Pubs and Bars in the UK</title>
    </head>
    <body>
    <?php if($messages) { displayErrors($messages); }?>
    <header>
    	<div id="title">
    		<h1>My Pub Space
    		 <a href="#" onClick="setActiveStyleSheet('default'); return false;"><img src="images/0.gif" width="15" height="15" border="0" alt="css style" /></a>
    		 <a href="#" onClick="setActiveStyleSheet('1'); return false;"><img src="images/1.gif" width="15" height="15" border="0" alt="css style" /></a>
    		 <a href="#" onClick="setActiveStyleSheet('2'); return false;"><img src="images/2.gif" width="15" height="15" border="0" alt="css style" /></a>
    		 <a href="#" onClick="setActiveStyleSheet('3'); return false;"><img src="images/3.gif" width="15" height="15" border="0" alt="css style" /></a>
    		 <span>
    			 <form method="post" class="textbox" action="search.php">
    					Town/City:&nbsp;<input type="text" size="26" class="searchbox" value="" name="RSTOWN" id="inputString" onKeyUp="lookup(this.value);" onBlur="fill();" />
    				
    				<div class="suggestionsBox" id="suggestions" style="display: none;">
    					<img src="images/upArrow.png" style="position: relative; top: -36px; left: 105px; z-index:1;" alt="upArrow" />
    					<div class="suggestionList" id="autoSuggestionsList">
    &nbsp;					</div>
    				</div>
    				<input type="image" src="images/go.png" height="30" with="30" value="GO" />
    			</form>
    		</span>		
    	  </h1>
    	</div>
    </header>
    <nav>
    	<ul>
    		<li><a href="default.php">Home</a></li>
    		<li><a href="#">Events</a></li>
    		<li class="selected"><a href="register.php">Register</a></li>
    	</ul>
    </nav>
    <section id="intro">
    	<header>
    		<h2>Your social guide to going down the pub, online!</h2>
    	</header>
    	<p>Stuck in town with nowhere to go? Not sure if up the road or down the street is best? Need to be somewhere warm, cosy and friendly. Need a drink?....<br />You've come to the right place, mypubspace has it all!</p>
    	<img src="images/pub.jpg" alt="pub" /> </section>
    <div id="content">
    	<div id="mainContent">
    		<section>
    			<article class="blogPost">
    				<header>
    				<? if ($msg <>"") 
    					{
    					echo "<div class=\"ui-widget\">
    				<div style=\"padding: 0pt 0.7em;\" class=\"ui-state-error ui-corner-all\"> 
    					<p style=\"padding-top:18px; font-style:normal;\"><span style=\"float: left; margin-right: 0.3em;\" class=\"ui-icon ui-icon-alert\"></span> 
    					<strong>Alert:</strong> $msg</p>
    				</div>
    			</div>"; 
    					} ?>
    					<h2>Register to My Pub Space</h2>
    					<form name="register" method="post" action="">
    					<input name="LoginCount" type="hidden" value="1" /><input name="LastLogin" type="hidden" value="<%= Now()%>" />
    						<table width="100%">
    							<tr>
    								<td class="text">Town:</td>
    								<td><span id="spryselect1">
    									<select name="rsTown" class="postcodedrop">
    										<?PHP while($row = mysql_fetch_array($result))
    								{
    								
    								echo '<option name=\"menuarea\" class=\"postcodedrop\" value='.$row['rsTown'].' />';
    								echo $row['rsTown'];
    								}?>
    									</select>
    									<span class="selectRequiredMsg">Please select an item.</span></span>
    		<a href="#" id="dialog_link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Why do you need my town?</a>
    		
    		<!-- ui-dialog -->
    		<div id="dialog" title="Why is do I need my Post Code?">
    			<p>The TOWN field is an important part in the My Pub Space registration process. My Pub Space has a very large database and needs to determine which town you are from, so that when you register, you will easily be able to access your local pubs. </p>
    		</div>
    			
    		</td>
    							</tr>
    							<tr>
    								<td class="text">Gender:</td>
    								<td>Male
    								  <input name="rsGender" type="radio" value="Male" />
    						Female
    						<input name="rsGender" type="radio" value="Female" /></td>
    							</tr>
    							<tr>
    								<td class="text">Username:</td>
    								<td><span id="sprytextfield1">
    									<input name="RSUSER" type="text" class="textbox" id="RSUSER" value="" />
       								<span id="msgbox" style="display:none"></span>
    									<span class="textfieldRequiredMsg">A value is required.</span></span></td>
    							</tr>
    							<tr>
    								<td class="text" valign="top">Password:</td>
    								<td><span id="sprytextfield2">
    									<input name="RSPASS" type="password" class="textbox" id="RSPASS" />
    									<span class="textfieldRequiredMsg">A value is required.</span></span></td>
    							</tr>
    							<tr>
    								<td class="text" valign="top"></td>
    								<td><i>must be between 4 and 15 chars containing alphanumeric chars only</i></td>
    							</tr>
    							<tr>
    								<td class="text">Confirm Password:</td>
    								<td><span id="sprytextfield3">
    									<input name="RSPASS2" type="password" class="textbox" id="RSPASS2" />
    									<span class="textfieldRequiredMsg">A value is required.</span></span></td>
    							</tr>
    							<tr>
    								<td class="text">Email:</td>
    								<td><span id="sprytextfield4">
    									<input name="rsEmail" type="text" class="textbox" id="rsEmail" />
    									<span class="textfieldRequiredMsg">A value is required.</span></span></td>
    							</tr>
    							<tr>
    								<td class="text">Mobile:</td>
    								<td><span id="sprytextfield5">
    									<input name="rsMobile" type="text" class="textbox" id="rsMobile" />
    									<span class="textfieldRequiredMsg">A value is required.</span></span></td>
    							</tr>
    							<tr>
    								<td class="text">Date of Birth:</td>
    								<td><span id="sprytextfield6">
    									<input name="rsAge" type="text" class="textbox" id="datepicker" />
    									<span class="textfieldRequiredMsg">A value is required.</span></span>
    									<!-- Datepicker -->
    									<div id="datepicker"></div>
    									</td>
    							</tr>
    							<tr>
    								<td class="text"></td>
    								<td>You must be over 18 to drink in UK pubs</td>
    							</tr>
    							<tr>
    								<td>&nbsp;</td>
    								<td><input name="register" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Register"></td>
    							</tr>
    						</table>
    					</form>
    				</header>
    			</article>
    		</section>
    	</div>
    	<aside>
    		<section>
    			<header>
    				<h3>My Pub Space</h3>
    			</header>
    			<form method="post" class="textbox" action="<?php print $_SERVER["PHP_SELF"]; ?>">
    				Username:&nbsp;<br />
    				<input type="text" class="textbox" name="RSUSER" value="<?php print isset($_POST["RSUSER"]) ? $_POST["RSUSER"] : "" ; ?>">
    				Password:&nbsp;<br />
    				<input type="password" class="textbox" name="RSPASS">
    				<br />
    				<br />
    				<input name="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Login">
    				<br />
    			</form>
    			<ul>
    				<li><button onclick="gohere('register.php')" id="button" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="register.php">Sign up</a></span></button></li>
    				<li><button id="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="forgot.php">Forgot Password</a></span></button></li>
    			</ul>
    		</section>
    		<section>
    			<header>
    				<h3>Landlords Pub Space</h3>
    			</header>
    			<form method="post" class="textbox" name="Landlord" action="landlord-login.php">
    				Username:&nbsp;<br />
    				<input type="text" class="textbox" name="rsUser1" value="<?php print isset($_POST["rsUser1"]) ? $_POST["rsUser1"] : "" ; ?>">
    				Password:&nbsp;<br />
    				<input type="password" class="textbox" name="rsPass1">
    				<br />
    				<br />
    				<input name="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Login">
    				<br />
    			</form>
    			<ul>
    				<li><button onclick="gohere('register.php')" id="button" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="register.php">Sign up</a></span></button></li>
    				<li><button id="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="forgot.php">Forgot Password</a></span></button></li>
    			</ul>
    		</section>
    		<section>
    			<header>
    				<h3>Quick Search</h3>
    			</header>
    			<ul>
    				<li>
    				<form name="form3" method="post" action="">
                  <select name="menu2" onChange="MM_jumpMenu('parent',this,0)" class="textbox">			
                    <option value="">Search by Town...</option>
    					<? 					
    					$town_pubs = mysql_query("SELECT DISTINCT RSTOWN, COUNT(PubID) As PubCount FROM pubs GROUP BY RSTOWN  ORDER BY RSTOWN ASC")
    					?>
    	
    						<?php while($row1 = mysql_fetch_array($town_pubs))
    						{
    						echo '<option value="town_pubs.php?rsTown='.$row1['RSTOWN'].'">'.$row1['RSTOWN'].'&nbsp;('.$row1['PubCount'].')</option>'; 
    						}
    						?>
                </select>
               </form>
    				</li>
    				<li>
    				<form name="form3" method="post" action="">
                  <select name="menu2" onChange="MM_jumpMenu('parent',this,0)" class="textbox">			
                    <option value="">Search by County...</option>
    					<? 					
    					$county_pubs = mysql_query("SELECT DISTINCT RSCOUNTY, COUNT(PubID) As PubCount1 FROM pubs GROUP BY RSCOUNTY  ORDER BY RSCOUNTY ASC")
    					?>
    	
    						<?php while($row1 = mysql_fetch_array($county_pubs))
    						{
    						echo '<option value="county_pubs.php?rsCounty='.$row1['RSCOUNTY'].'">'.$row1['RSCOUNTY'].'&nbsp;('.$row1['PubCount1'].')</option>'; 
    						}
    						?>
                </select>
               </form>
    				</li>
    			</ul>
    		</section>
    	</aside>
    </div>
    <footer>
    	
    </footer>
    <script type="text/javascript">
    <!--
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    //-->
    </script>
    </body>
    </html>

  • #7
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    please help?

  • #8
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,313
    Thanks
    4
    Thanked 206 Times in 203 Posts
    What is the result of the echo $sql; after your insert statement?
    Dave .... HostMonster for all of your hosting needs

  • #9
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    I don't know, I can't echo it out?!

  • #10
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,313
    Thanks
    4
    Thanked 206 Times in 203 Posts
    That area of code is only going to be run when a post variable named register is set which looks like it should happen at some point if a person isn't already registered or logged in.
    Dave .... HostMonster for all of your hosting needs

  • #11
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question

    hmm yeah, still don't know what to do about the one word town entry?!

  • #12
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by jarv View Post
    I don't know, I can't echo it out?!
    why?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #13
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    when I try to echo it out, it doesn't do it, I don't know why?!

  • #14
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question

    I have now found the problem with the 1 word and made it say the full 2 words - it was the value in the form that was wrong.

    I am still having problems elsewhere and can't echo my PHP, can someone please help?

  • #15
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    why?

    I don't know, that is why I am here asking for help!


  •  

    Posting Permissions

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