redarrow Posted April 18, 2006 Share Posted April 18, 2006 This comes from the database and pulls the names correctly.[code]echo"<OPTION VALUE='".$record["name"]."'>".$record["name"];[/code]I was trying to pull the names and the date from the same user fileld to show name and date from pull down together.example but wrong can you help cheers.[code]echo"<OPTION VALUE='".$record["name"]."' '".$record["date"]."'>".$record["name"] $record["date"];[/code]Advance thank you. Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/ Share on other sites More sharing options...
AndyB Posted April 18, 2006 Share Posted April 18, 2006 And what happens or doesn't happen when you use that code? Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28145 Share on other sites More sharing options...
redarrow Posted April 18, 2006 Author Share Posted April 18, 2006 Keep getting a phase errow on that line.[code]Parse error: parse error, expecting `','' or `';'' in C:\Program Files\Apache Group\Apache2\htdocs\collage\project\search.php on line 17[code] Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28147 Share on other sites More sharing options...
craygo Posted April 18, 2006 Share Posted April 18, 2006 you need to get rid of the single quotes. should be[code]echo"<OPTION VALUE='".$record["name"]." ".$record["date"]."'>$record['name'] $record['date']</OPTION>";[/code]Ray Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28148 Share on other sites More sharing options...
redarrow Posted April 18, 2006 Author Share Posted April 18, 2006 [!--quoteo(post=365989:date=Apr 18 2006, 01:23 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Apr 18 2006, 01:23 PM) [snapback]365989[/snapback][/div][div class=\'quotemain\'][!--quotec--]you need to get rid of the single quotes. should be[code]echo"<OPTION VALUE='".$record["name"]." ".$record["date"]."'>$record['name'] $record['date']</OPTION>";[/code]Ray[/quote][code]Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Apache Group\Apache2\htdocs\collage\project\search.php on line 17[/code]still wrong sorry Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28149 Share on other sites More sharing options...
AndyB Posted April 18, 2006 Share Posted April 18, 2006 [code]echo "<OPTION VALUE='". $record["name"]. " ". $record["date"]. "'>". $record['name'] $record['date']. "</OPTION>";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28156 Share on other sites More sharing options...
craygo Posted April 18, 2006 Share Posted April 18, 2006 Ya i see i tested my code out with just some variables above. This worked for me[code]echo"<OPTION VALUE='".$record['name']." ".$record['date']."'>".$record['name']." ".$record['date']."</OPTION>";[/code]Ray Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28157 Share on other sites More sharing options...
redarrow Posted April 18, 2006 Author Share Posted April 18, 2006 Test it with a database to get name and date on the same pull down menu dosent work agree varables without database works.The full code test it on a database dosent work but name on it's own does.[code]<html><head><title>search2</title><body>search me via search box<form method="post" action="search_result.php"><SELECT NAME="name"><?$db=mysql_connect("localhost","xxx","xxx");mysql_select_db("schollwork", $db);$query="select * from feedback";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){echo "<OPTION VALUE='". $record["name"]. " ". $record["date"]. "'>". $record['name'] $record['date'].;}?></select><input type="submit" value="submit"></form></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28159 Share on other sites More sharing options...
AndyB Posted April 18, 2006 Share Posted April 18, 2006 [code]echo "<OPTION VALUE='". $record["name"]. $record["date"]. "'>". $record['name']. "". $record['date']. "</OPTION>";[/code]That works. You might want to separate the name and date with | to make it easier to split them later.[code]echo "<OPTION VALUE='". $record["name"]. $record["date"]. "'>". $record['name']. "|". $record['date']. "</OPTION>";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28166 Share on other sites More sharing options...
redarrow Posted April 18, 2006 Author Share Posted April 18, 2006 Thank you andy in the end all i needed to see the date and not get the script to search via name and date cheers thanks so much.[code]<html><head><title>search2</title><body>search me via search box<form method="post" action="search_result.php"><SELECT NAME="name"><?$db=mysql_connect("localhost","xxxx","xxxx");mysql_select_db("schollwork", $db);$query="select * from feedback";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){echo "<OPTION VALUE='". $record["name"]."'>". $record['name']. " ". $record['date']. "</OPTION>";}?><input type="submit" value="submit"></form></body></html>[/code][!--sizeo:6--][span style=\"font-size:24pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--] Quote Link to comment https://forums.phpfreaks.com/topic/7714-i-was-trying-to-pull-the-names-and-the-date-form-the-same-user-fileld/#findComment-28176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.