Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] substring select or like select in dropdown menu


[SOLVED] substring select or like select in dropdown menu

Reply
  #1 (permalink)  
Old 08-14-08, 04:01 PM
snakeob snakeob is offline
Newbie Coder
 
Join Date: Jun 2008
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] substring select or like select in dropdown menu

hello im having some trouble figureing out which method i should use,
basicly im trying to get this to have in the first menu the number you want to select(which works)
butthe tricky part is for the other two dropdown menus i want to be able to select the month and year, but they are both in one column, should i split the column into two, or should i use a substring? im lost please help

heres my code

PHP Code:

$result mysql_query("SELECT DISTINCT callroutein FROM call_list");


echo 
"<h2>Please select the client and month that you  would like to generate a bill for<h2>";
echo 
"<form action='processform.php' method='POST'>";
echo 
"<select name='number'>\n";
while ( 
$row mysql_fetch_array($result))
{
    echo 
"<option value='{$row['callroutein']}'>";
    echo 
$row['callroutein']."\n";
}

echo 
"</select>";
echo 
"\t";

$result2 mysql_query("SELECT DISTINCT * FROM call_list WHERE calldate LIKE '' ");

echo 
"<form action='processform.php' method='POST'>";
echo 
"<select name='month'>\n";
while ( 
$row mysql_fetch_array($result2))
{
        echo 
"<option value='{$row['calldate']}'>" "</option>";
        echo 
$row['calldate']."\n";
}
echo 
"</select>";

$result3 mysql_query("SELECT DISTINCT substring(calldate,8,4)AS calldate FROM call_list ORDER BY calldate ASC ");

echo 
"<form action='processform.php' method='POST'>";
echo 
"<select name='year'>\n";
while ( 
$row mysql_fetch_array($result3))
{
        echo 
"<option value='{$row['calldate']}'>" "</option>";
    echo 
$row['calldate']."\n";
}
echo 
"</select>";

echo 
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp";
echo 
"\n<input type='submit' value= 'Submit'>";
echo 
"\n</form>\n"
Reply With Quote
  #2 (permalink)  
Old 08-15-08, 11:33 AM
snakeob snakeob is offline
Newbie Coder
 
Join Date: Jun 2008
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
please help

iv gotten to where i can get the proper names to display in the drop downs but now once i try getting them into one query i get errors...

PHP Code:

<?php

$result 
mysql_query("SELECT * FROM biller WHERE account,calldate,calldate LIKE" $_POST['number'] . $_POST['year'] . $_POST['month']);

while (
$row mysql_fetch_array($result))
{
    
$account=$row['account'];
    
$calldend=$row['calldateend'];
    
$calldstart=$row['calldatestart'];
    
$calldate=$row['calldate'];
    
$totalctime=$row['totalcalltime'];
    
$totalccharge=$row['totalcallcharge'];
    
$charge=$row['charge'];
    
$origin=$row['origin'];
    
$nava=$row['navagataid'];

print 
"<tr>
    <td>
$account</td>
    <td>
$calldend</td>
    <td>
$calldstart</td>
    <td>
$calldate</td>
    <td>
$totalctime</td>
    <td>
$totalccharge</td>
    <td>
$charge</td>
    <td>
$origin</td>
    <td>
$navi</td>
</tr>"
;

}
?>

please help
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AnyLink Drop Down Menu - Smarty Error? shadyy510 JavaScript 2 05-08-08 11:44 AM
dropdown menu problem gigafare JavaScript 0 05-19-06 10:33 AM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 08:05 AM
MySQL Field Names into PHP Dropdown Menu KaraJ PHP 4 06-14-05 09:28 AM


All times are GMT -5. The time now is 07:53 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.