Jump to content

Archived

This topic is now archived and is closed to further replies.

hustler

PHP adding value help

Recommended Posts

hi,
i have a form in admin panel from where we add quote for username, at the moment it gives an option to select the username and then enter the details for him.
But i want an extra field with select box wher i can enter the username directly to enter his records.

here is the code
[code]
<?php
if(!empty($req_form_action)){
    if($req_form_action=="addQuickQuote"){
        //check for valid reference number
        $strQuery="SELECT count(*) FROM master_quotes WHERE reference_number LIKE '".$req_ref_num."'";
        if($dbConn->getValue($dbConn->executeQuery($strQuery),0)>0){               
            //insert
            $strSQL="INSERT INTO quick_quotes VALUES (    NULL,
                                                        ".$req_member_id.",
                                                        '".$req_contact_name."',
                                                        '".$req_group_id."',
                                                        '".$req_ref_num."')";

            //echo $strSQL;                                   
            if($dbConn->executeQuery($strSQL))
                $log="Quote Added<br>";           
            else
                $log=mysql_error();
        }
        else{
            $log="The reference number: <b>".$req_ref_num."</b> does not exists in master database.";
        }       

    }       
}
if(!empty($log)) echo "<font color=red>".$log."</font><br>";
//list    groups
$strSQL="SELECT * FROM groups ORDER By groupname";
$res=$dbConn->executeQuery($strSQL);
$groups=array();
while($group=$dbConn->getRecords($res)){
    $groups[]=$group;
}       

if(count($groups)==0)
    echo "No groups were found. <a href=admin.php?c=addGroup>Click here</a> to create group first.<br>";
else{           
?>
<form method=post>
    <input type=hidden name="form_action" value="addQuickQuote">
   
    <table cellspacing=0 cellpadding=0 width=90% border=1>
    <?php
   
        //list    members   
        require_once("includes/class.member.php");
        $objMember=new Member();       
        $arrMemberList=$objMember->getMembers("on");
        if(count($arrMemberList)==0)
            echo "No activated members were found.<br>";   
        else{
   
    ?>
        <tr>
            <td>Select Member</td>
            <td>
           
                <select name=member_id class=fieldbox>
<?php
            while($member=array_pop($arrMemberList)){
                echo "<option value='".$member["id"]."'>".$member["username"]."\n";   
            }
?>                   
                </select>
            </td>           
        </tr>
<?php
        }   
?>   
        <tr>
            <td>Contact name</td>
            <td>
                <INPUT size=19 name="contact_name" type=text class=fieldbox>
            </td>
        </tr>   
        <tr>
            <td>Group</td>
            <td>
                <select name=group_id class=fieldbox>
<?php
while($group=array_pop($groups)){
    echo "<option value='".$group["id"]."'>".$group["groupname"]."\n";
}
?>                   
                </select>
            </td>           
        </tr>   
        <tr>
            <td>Reference Name</td>
            <td>
                <INPUT size=19 name="ref_num" type=text class=fieldbox>
            </td>           
        </tr>   
        <tr>           
            <td colspan=2 align=center><input type=submit value="Add Quick Quote" class=fieldbox></td>
        </tr>       
    </table>
</form>       
<?php   
}
?>
[/code]

you experianced people can figure it out very easily but being having very little php knowledge i cant figure it out.

what i want is just an option with the select box where i can enter the username directly rather than selecting it.

This is current what it is

Select member :_____ (this is drop down, which shows all members)
Contact name: ____-
Group:_________
Reference number:___________-

I want it like this
Select member :_____ (this is drop down) or Enter Member name______
Contact name: ____
Group:_________
Reference number:___________

all help appreciated!

Share this post


Link to post
Share on other sites
ok can anyone guide me for

Just replacing the
<select> box which shows usernames to select 
to
Input box where i can enter the username directly

Thanx

Share this post


Link to post
Share on other sites
that means this is a part which shows select box with all usernames

[code]<?php
   
        //list    members   
        require_once("includes/class.member.php");
        $objMember=new Member();       
        $arrMemberList=$objMember->getMembers("on");
        if(count($arrMemberList)==0)
            echo "No activated members were found.<br>";   
        else{
   
    ?>
        <tr>
            <td>Select Member</td>
            <td>
           
                <select name=member_id class=fieldbox>
<?php
            while($member=array_pop($arrMemberList)){
                echo "<option value='".$member["id"]."'>".$member["username"]."\n";   
            }
?>                   
                </select>[/code]

but i want a simple input box where i can enter username myself instead of selecting.

Thanx

Share this post


Link to post
Share on other sites
try[code]<form method=post>
    <input type=hidden name="form_action" value="addQuickQuote">
   
    <table cellspacing=0 cellpadding=0 width=90% border=1>
    <?php
   
        //list    members   
        require_once("includes/class.member.php");
        $objMember=new Member();       
        $arrMemberList=$objMember->getMembers("on");
        if(count($arrMemberList)==0)
            echo "No activated members were found.<br>";   
        else{
   
    ?>
        <tr>
            <td>Select Member</td>
            <td>
           
                <select name=member_id class=fieldbox>
<?php
            while($member=array_pop($arrMemberList)){
                echo "<option value='".$member["id"]."'>".$member["username"]."\n";   
            }
?>                   
                </select>
            </td> 
            <td>
            or Enter Member name:<input type="text" name="UserName" />
            </td>         
        </tr>
<?php
        }   
?>   
        <tr>
            <td>Contact name</td>
            <td colspan="2">
                <INPUT size=19 name="contact_name" type=text class=fieldbox>
            </td>
        </tr>   
        <tr>
            <td>Group</td>
            <td colspan="2">
                <select name=group_id class=fieldbox>
<?php
while($group=array_pop($groups)){
    echo "<option value='".$group["id"]."'>".$group["groupname"]."\n";
}
?>                   
                </select>
            </td>           
        </tr>   
        <tr>
            <td>Reference Name</td>
            <td colspan="2">
                <INPUT size=19 name="ref_num" type=text class=fieldbox>
            </td>           
        </tr>   
        <tr>           
            <td colspan="3" align=center><input type=submit value="Add Quick Quote" class=fieldbox></td>
        </tr>       
    </table>
</form>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.