hey guys i have this line

$result=mysql_query($query) or die(mysql_error());
$option="";
while($row=mysql_fetch_array($result)) {
   $option.="<option value=".$row['firstname; lastname'].">".$row['firstname; lastname']."</option>";    
}

Now i need to fetch the last name and first names and put them into those option values...

hows that done? If i go

lastname, firstname

I get nothing, if i just say

firstname

or

lastname

It works perfectly.

any ideas?

Recommended Answers

All 18 Replies

My suggestion is, always use integer values if you are are updating a table based on the choice made. Because, it ll be easy for you to update.
But I guess your table structure is not that good.. Do you have an autoincrement field(id or counter or anything like that ?). If you do, then you can fetch first name, last name and id of every users, put id for option value.
Eg. say you have id, firstname, lastname in your table.

<?php
//connect
//select db
$query="select id,firstname,lastname from table";
$result=mysql_query($query);
$option="";
while($row=mysql_fetch_array($result)){
$name=$row['firstname']." ".$row['lastname'];
$id=$row['id'];
  $option.="<option value=$id>$name</option>";
}
?>

This will show the first name and last name as a choice, but when selected, it sends the id of that user.

Cheers,
Naveen

It may be a good idea ti have a unique id to accompany the firstname lastname pair and submit the id instead of the name itself.

for example
<?php

$result=mysql_query($query);

$option="";

while($data=mysql_fetch_array($result)){

$option.="<option value=".$row.">".$row."".$row."</option>";

}

?>

this should give id name pair like this.
1 doe john
2 kamau kuria
etc etc

It may be a good idea ti have a unique id to accompany the firstname lastname pair and submit the id instead of the name itself.

for example
<?php

$result=mysql_query($query);

$option="";

while($data=mysql_fetch_array($result)){

$option.="<option value=".$row.">".$row."".$row."</option>";

}

?>

this should give id name pair like this.
1 doe john
2 kamau kuria
etc etc

Well now thats a unique idea......whoa....whoa....whoa....wait a minit isnt that the exact same thing nav33n just said :P

I also reccomend adding a user_id field to the table, it makes things a lot easier in the long run.

;)

ok i got that working but now i am having some issues with querying the first and last names from the database...

Heres the code i have....

<?php

// Include the configuration file for error management and such.
// require_once ('/home/.flipside/bullseye/web/design.anblickstudios.com/includes/'); 


if (isset($_POST['submitted'])) { // Check if the form has been submitted.

	require_once ('mysql_connect.php'); // Connect to the database.

$errors = array(); // Initialize error array

	// Validate the first name
	if (!empty($_POST['firstname'])) {
		$F = escape_data($_POST['firstname']);
	} else {
		echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
		$F = FALSE;
	}
	
		// Validate the last name
	if (!empty($_POST['lastname'])) {
		$L = escape_data($_POST['lastname']);
	} else {
		echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
		$L = FALSE;
	}
	
	// Validate the password.
	if (!empty($_POST['password'])) {
		$p = escape_data($_POST['password']);
	} else {
		$p = FALSE;
		echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
	}
	
	if (empty($errors)) { // If everything's OK.
	
	
		// Query the database.
		$query = "SELECT firstname, lastname FROM grads WHERE (firstname,lastname ='$F,$L' AND password=SHA1('$p')) " or die(mysql_error());	
		$result = @mysql_query ($query); // Run the Query
		$row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable
		
		if ($row) { // A record was pulled from the database.

			// Register the values & redirect.
			session_start();
			$_SESSION['firstname'] = $row[0];
			$_SESSION['lastname'] = $row[1];		
			$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
							
			// Start defining the URL.
			$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
			// Check for a trailing slash.
			if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
				$url = substr ($url, 0, -1); // Chop off the slash.
			}
			// Add the page.
			$url .= '/loggedin.php';
			
			
			header("Location: $url");
			exit(); // Quit the script.
				
		} else { // No record matched the query
			$errors[] = 'The name and password entered do not match those on file.';
			// Public Message
			$errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message 
		}
		
	} // End of if (empty($errors)) IF.
		
	mysql_close(); // Close the database connection.

} else { // Form has not been submitted

$erorrs = NULL;

} // End of the main SUBMIT conditional.

//Begin the page now
$page_title = 'Login';

if (!empty($errors)) { //Print any error messages.
	echo '<h1 id="mainhead">Error!</h1>
	<p class="error">The following error(s) occurred:<br />';
	foreach ($errors as $msg) { // Print each error.
		echo " - $msg<br />\n";
		}
		echo '</p><p>Please try again.</[>';
	}
	
?>

<h1>Login</h1>
<p>Your browser must allow cookies in order to log in.</p>
<form action="login.php" method="post">
	<fieldset>
	<p><b>First Name:</b> <input type="text" name="firstname" size="20" maxlength="40" value="<?php if (isset($_POST['firstname'])) echo $_POST['firstname']; ?>" />
    <b>Last Name:</b> <input type="text" name="lastname" size="20" maxlength="40" value="<?php if (isset($_POST['lastname'])) echo $_POST['lastname']; ?>" />    
    </p>
	<p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
	<input type="submit" name="submit" value="Login" />
	<input type="hidden" name="submitted" value="TRUE" />
	</fieldset>
</form>

The exact error i get is

Error!

The following error(s) occurred:
- The name and password entered do not match those on file.
- Operand should contain 1 column(s)

Query: SELECT firstname, lastname FROM grads WHERE (firstname,lastname ='****,****' AND password=SHA1('**************'))

Please try again.

Any ideas?

Here is the other code... il explain whats going on bellow

Login.php

<?php

// Include the configuration file for error management and such.
// require_once ('/home/.flipside/bullseye/web/design.anblickstudios.com/includes/'); 


if (isset($_POST['submitted'])) { // Check if the form has been submitted.

	require_once ('mysql_connect.php'); // Connect to the database.

$errors = array(); // Initialize error array

	// Validate the first name
	if (!empty($_POST['firstname'])) {
		$F = escape_data($_POST['firstname']);
	} else {
		echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
		$F = FALSE;
	}
	
		// Validate the last name
	if (!empty($_POST['lastname'])) {
		$L = escape_data($_POST['lastname']);
	} else {
		echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
		$L = FALSE;
	}
	
	// Validate the password.
	if (!empty($_POST['password'])) {
		$p = escape_data($_POST['password']);
	} else {
		$p = FALSE;
		echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
	}
	
	if (empty($errors)) { // If everything's OK.
	
	
		// Query the database.
		$query = "SELECT firstname='$F',  lastname='$L' FROM grads WHERE (password=SHA1('$p')) " or die(mysql_error());	
		$result = @mysql_query ($query); // Run the Query
		$row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable
		
		if ($row) { // A record was pulled from the database.

			// Register the values & redirect.
			session_start();
			$_SESSION['firstname'] = $row[0];
			$_SESSION['lastname'] = $row[1];		
			$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
							
			// Start defining the URL.
			$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
			// Check for a trailing slash.
			if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
				$url = substr ($url, 0, -1); // Chop off the slash.
			}
			// Add the page.
			$url .= '/vote.php';
			
			
			header("Location: $url");
			exit(); // Quit the script.
				
		} else { // No record matched the query
			$errors[] = 'The name and password entered do not match those on file.';
			// Public Message
			$errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message 
		}
		
	} // End of if (empty($errors)) IF.
		
	mysql_close(); // Close the database connection.

} else { // Form has not been submitted

$erorrs = NULL;

} // End of the main SUBMIT conditional.

//Begin the page now
$page_title = 'Login';

if (!empty($errors)) { //Print any error messages.
	echo '<h1 id="mainhead">Error!</h1>
	<p class="error">The following error(s) occurred:<br />';
	foreach ($errors as $msg) { // Print each error.
		echo " - $msg<br />\n";
		}
		echo '</p><p>Please try again.</[>';
	}
	
?>

<h1>Login</h1>
<p>Your browser must allow cookies in order to log in.</p>
<form action="login.php" method="post">
	<fieldset>
	<p><b>First Name:</b> <input type="text" name="firstname" size="20" maxlength="40" value="<?php if (isset($_POST['firstname'])) echo $_POST['firstname']; ?>" />
    <b>Last Name:</b> <input type="text" name="lastname" size="20" maxlength="40" value="<?php if (isset($_POST['lastname'])) echo $_POST['lastname']; ?>" />    
    </p>
	<p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
	<input type="submit" name="submit" value="Login" />
	<input type="hidden" name="submitted" value="TRUE" />
	</fieldset>
</form>

and...

vote.php

<?php
session_start(); // Start the session
$conn=mysql_connect("*****","*****","****") or die(mysql_error());
mysql_select_db("db33717_gradsurvey") or die(mysql_error());

$query="SELECT firstname,lastname FROM grads ORDER BY `grads`.`lastname` ASC" or die(mysql_error());

$result=mysql_query($query);
$option="";
while($row=mysql_fetch_array($result)){
$name=$row['firstname']." ".$row['lastname'];

  $option.="<option value=$name>$name</option>";
}

if(isset($_POST['submit'])) {
// Mail Script

$a=$_POST['priceisright'];
$b=$_POST['millionaire'];
$c=$_POST['loosepassport'];
$d=$_POST['vanriver'];
$e=$_POST['spusecheat'];
$f=$_POST['marrymoney'];
$g=$_POST['5divorces'];
$h=$_POST['primeminister'];
$i=$_POST['teacheci'];
$j=$_POST['40yearoldvirgin'];
$k=$_POST['livewparents'];
$l=$_POST['dieholdingcell'];
$m=$_POST['damagedliver'];
$n=$_POST['jail'];
$q=$_POST['plasticsurgery'];
$r=$_POST['adoptchildren'];
$s=$_POST['buyfriends'];
$t=$_POST['Dictionary'];
$p=$_POST['eci5years'];
$u=$_POST['guitarhero'];
$v=$_POST['convent'];
$w=$_POST['souljaboywedding'];
$x=$_POST['nobelpeace'];
$y=$_POST['huggerenvironment'];
$z=$_POST['mack'];
$aa=$_POST['ego'];
$ab=$_POST['partier'];
$ac=$_POST['cougar'];
$ad=$_POST['awkward'];
$ae=$_POST['dramtic'];
$af=$_POST['gossip'];
$ag=$_POST['cluts'];
$ah=$_POST['car'];
$ai=$_POST['style'];
$aj=$_POST['hair'];
$ak=$_POST['cutestcouple'];
$al=$_POST['hottestparents'];
$am=$_POST['playboygirl'];
$an=$_POST['kingswaymd'];
$aq=$_POST['funniest'];
$ar=$_POST['athletic'];


$message = "

Name: {$_POST ['$F,$L']}
{$_SESSION ['firstname'] ['lastname']}

Price is right: $a
Become a millionaire: $b
Loose Passport: $c
Live in a van: $d
Cheat on Spouse: $e
Marry For money: $f
Divorces: $g
Prime Minister: $h
Teach at ECI: $i
40 year old Virgin: $j
Live with their parents: $k
Die holding their cell phone: $l
Damaged Liver before 19: $m
End up in jail: $n
Plastic Surgery: $q
Adopt Children: $r
Buy their friends: $s
Memorize the Dictionary: $t
Eci in 5 years: $p
Guitar Hero: $u
Convent: $v
Soulja boy at wedding: $w
Nobel Peace Prize: $x
Tree Hugger/ Environmentally friendly: $y
Biggest Mack: $z
Biggest Partier: $aa
Biggest Partier: $ab
Biggest Cougar: $ac
Most Awkward: $ad
Most Dramatic: $ae
Biggest Gossip: $af
Biggest Cluts: $ag
Best Car: $ah
Best Style: $ai
Best Hair: $aj
Cutest Couple: $ak
Hottest Parents: $al
Playboy/Playgirl: $am
Kingsway Mom and Dad: $an
Funniest: $aq
Most Athletic: $ar";


mail("ecigrads08@gmail.com","{$_SESSION ['firstname']}{$_SESSION ['lastname']}:Grad Survey 08",$message,"from: dani@anblickstudios.com");


// Start defining the URL.
			$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
			// Check for a trailing slash.
			if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
				$url = substr ($url, 0, -1); // Chop off the slash.
			}
			// Add the page.
			$url .= '/thanks.php';	
			
			header("Location: $url");
			exit(); // Quit the script.


}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
</head>
<body>


<?php
// Welcome the user
echo '<h2>Welcome';
if (isset($_SESSION['firstname'] ['lastname'])) {
	echo ", {$_SESSION['firstname'] ['lastname']}!";
}
echo '</h2>';
?>
<b>INSTRUCTIONS:</b>

<p>The following are the questions for the 2008 Grad Survey. Please answer all questions
and please only submit this form once. If you submit more than once, your survey will be ignored.
<br />
Once you submit, please logout using the link provided on the "thank you" page.
<br />
Finally The survey will run until the end of March 2008 and there will be NO extensions.
<br /><br />

Sincerely,<br  />
The Happy ECI Yearbook Team!
</p>

<form name="gradsurvey08" action="vote.php" method="post" >
<fieldset>



<Label> <b>Most likely to...</b></Label><br />


<label>1. Be on the price is right</label><br />
<select name="priceisright">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>2. Become a millionaire</label><br />
<select name="millionaire">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>3. Loose passport in Europe</label><br />
<select name="loosepassport">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>4. Live in a van by the river</label><br />
<select name="vanriver">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>5. Cheat on Spouse</label><br />
<select name="spusecheat">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>6. Marry for money</label><br />
<select name="marrymoney">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>7. have 5 divorces before 30</label><br />
<select name="5divorces">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>8. Be prime minister of Canada</label><br />
<select name="primeminister">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>9. Teach at ECI</label><br />
<select name="teacheci">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>10. Be a 40 year old virgin</label><br />
<select name="40yearoldvirgin">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>11. Live with their parents</label><br />
<select name="livewparents">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>12. Die holding their cell phone</label><br />
<select name="dieholdingcell">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>13. Have a damaged liver before 19</label><br />
<select name="damagedliver">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>14. End up in jail</label><br />
<select name="jail">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>15. Get plastic surgery on their whole body</label><br />
<select name="plasticsurgery">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>16. Adopt children from a 3rd world</label><br />
<select name="adoptchildren">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>17. Buy their friends</label><br />
<select name="buyfriends">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>18. Memorize the Dictionary</label><br />
<select name="Dictionary">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>19. Still be at ECI in 5 years</label><br />
<select name="eci5years">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>20. Become the true Guitar Hero</label><br />
<select name="guitarhero">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>21. Join a Convent</label><br />
<select name="convent">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>22. Dance to Soulja boy at their wedding</label><br />
<select name="souljaboywedding">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>23. Win the nobel peace prize</label><br />
<select name="nobelpeace">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>24. Be the biggest tree hugger/environmentally friendly</label><br />
<select name="huggerenvironment">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label><b>Biggest</b></label><br />

<label>25. Mack </label><br />
<select name="mack">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>26. Ego</label><br />
<select name="ego">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>27. Partier</label><br />
<select name="partier">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>28. Cougar</label><br />
<select name="cougar">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>29. Awkward</label><br />
<select name="awkward">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>30. Dramatic</label><br />
<select name="dramatic">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>31. Gossip</label><br />
<select name="gossip">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>32. Cluts</label><br />
<select name="cluts">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label><b> Best</b></label><br />

<label>33. Car</label><br />
<select name="car">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>34. Style</label><br />
<select name="style">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>35. Hair</label><br />
<select name="hair">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label> <b>------------------------------------------------------------</b></label><br />

<label>36. Cutest Couple</label><br />
<select name="cutestcouple">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>37. Hottest Parents</label><br />
<select name="hottestparents">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>38. Playboy/Playgirl</label><br />
<select name="playboygirl">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>39. Kingsway Mom & Dad</label><br />
<select name="kingswaymd">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<label>40. Funniest</label><br />
<select name="funniest">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>

<br />

<label>41. Most athletic</label><br />
<select name="athletic">
  <option value="">Please Choose One Person</option>
  <option value="Not Voting">Not Voting</option>
	<?php echo $option; ?>
</select>
<br />

<input name="submit" value="submit" type="submit">





</form>


</body>
</html>

So basically since i added the firstname and lastname stuff i am totally lost. Could you guys give me a hand with modifying my stuff since i have no clue how to do stuff when you have 2 separate things ( instead of having the name in 1 column)

Hope someone can give me a hand.

Thanks again, Dani

I guess you didn't see my example ?

i did but i dont have that id thinggy, nor do i know what to do with it.

What your saying is create an auto inrimental field.

can i still create that even though my database is created and setup?

and then whats that going to do for me?

Well, If you dont have an id field, what/how do you plan to update the table ? because, there can be people with same first name and same last name. You need to have an id field. Anyway, you can make use of concat function in mysql to join those 2 fields.
Eg. select concat(firstname,lastname) as name from table;

so then i would just call name? and that would hold both first and last?

try it out ! :)

kk i will do that give me a few minutes.

ok it works but now the firstname and lastname come up all bunched into 1 word, hows a space added there.

also how am i going to modify my whole login script to use tihs now? I have it verifying the first name and then the last name... Then i use that and create a session variable to use later on so i know whos voting.

how can i do that now?

ok it works but now the firstname and lastname come up all bunched into 1 word, hows a space added there.

Add a white space in the concat function.

also how am i going to modify my whole login script to use tihs now? I have it verifying the first name and then the last name... Then i use that and create a session variable to use later on so i know whos voting.

how can i do that now?

Don't you have a separate username/loginname field ? Umm.. My suggestion is to change the table structure itself. But if you want to use the same table, then you can ask the user to enter his firstname and password, and then compare it with the values in the table for that first name and password.

commented: awesome help yet again! Well done +1

i got it, thanks man, i just added that same query to the login and ask the user to enter their full name.

Thanks again for wonderful help. Hopefully now the survey can stay up and wont have issues..

:P

:) awesome!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.