0% found this document useful (0 votes)
33 views

'Phone' 'Dbconn - PHP' "Select From Inquery Where Phone '$phone1'"

This document contains PHP code to retrieve user data from a database based on their phone number stored in a session variable. It then uses this data to populate form fields for a user profile creation page. The form collects user details like name, gender, phone number, department, person to meet. It includes JavaScript for input validation.

Uploaded by

Sushank Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

'Phone' 'Dbconn - PHP' "Select From Inquery Where Phone '$phone1'"

This document contains PHP code to retrieve user data from a database based on their phone number stored in a session variable. It then uses this data to populate form fields for a user profile creation page. The form collects user details like name, gender, phone number, department, person to meet. It includes JavaScript for input validation.

Uploaded by

Sushank Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

<?

php
 $phone1=$_SESSION['phone'];
include('dbconn.php');
$sql="Select * from inquery where Phone='$phone1'";
$query=mysqli_query($db,$sql);
$fetch=mysqli_fetch_array($query);
?>

<!DOCTYPE html>
<html>
<head>    
<script>
function onlyAlphabets(evt) {
        var charCode;
        if (window.event)
            charCode = window.event.keyCode;  //for IE
        else
            charCode = evt.which;  //for firefox
        if (charCode == 32) //for &lt;space&gt; symbol
            return true;
        if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII
Table
            return false;
        if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a'
in ASCII Table
            return false;
        if (charCode > 122) //for characters beyond 'z' in ASCII Table
            return false;
        return true;
    }

</script>
<title>Create pass</title>    
<link rel="stylesheet" href="../css/createpass_1.css">

 </head>
 <body onload='document.form1.text1.focus()'>
 <form action="new.php" method="post" name="form1">
<div class="back_ground">    
<h1>Create Pass</h1>        
    <div class="left">
        <input type="text" name="name1" onkeypress="return
onlyAlphabets(event);"  
        placeholder="Name" value="<?php echo $fetch[1] ?>"  
        style="width: 70%; height:30px; border-radius: 10px;border:none; margin-
left: 22px; padding: 5px;margin-top: 10px;"><br>            
        <label style="margin-left:22px;">Gender : </label><br><br>            
        <div style="margin-top: -8px;margin-left: 46px;">          
        <input <?php if($fetch[2]=="male"){echo "checked";} ?> type="radio"
name="gender" value="male" style="margin-left: 18px;"><label>Male</label>      
        <input <?php if($fetch[4]=="female"){echo "checked";} ?> type="radio"
name="gender" value="female"><label>Female</label><br></div>
        <input type="Number" name="phone" readonly="readonly" placeholder="Phone
No" value="<?php echo
        $phone1 ?>" style="width: 70%; height: 30px; color: #000; border-radius:
10px;border:none;
        margin-left: 22px; padding: 5px; margin-top: 18px;"><br><br>
        <label style="margin-left: 22px;">Department : </label><br><br>
        <div style="margin-top: -8px; margin-left: 60px;">                
        <select name="department"  style="width: 80%; height: 30px; border-
radius: 10px;border:none; margin-left: -40px; padding: 5px; margin-top: 10px;
color: #000">
        <?php                          
        include ('dbconn.php');
        $sql="Select * from department";
        $query=mysqli_query($db,$sql);
                       
            while($fetch=mysqli_fetch_array($query)) {
        ?>
        <option value="<?php echo $fetch[1]?>"><?php echo $fetch[1]?></option>

        <?php
        }
        ?>

        </select>
        </div><br>
            <label style="margin-left: 22px;">Whom To Meet : </label><br><br>
            <div style="margin-top: -8px; margin-left: 60px;">
                <select name="person_meet"   style="border-radius: 10px; height:
30px;color: #000; width: 80%; margin-left: -40px;">
                    <?php
                        include ('dbconn.php');
                        $sql="Select * from emp_table";
                        $query=mysqli_query($db,$sql);
                       
                        while($fetch=mysqli_fetch_array($query)) {
                            ?>
                            <option value="<?php echo $fetch[1]?>"><?php echo
$fetch[1]?></option>

                            <?php
                        }
                    ?>
                   

                </select>
            </div>
            <input type="submit" name="submit" value="Create"  style="width:
40%; height: 26px; border-radius: 10px;border:none; margin-left: 100px; padding:
5px; margin-top: 35px; cursor: pointer; color: #000">
        </div>
        <div class="right">
            <div class="image_box">
           
                   
                <input type="hidden" id="a" name="image">
           
            </div>
                <!--<input type="submit" value="capture" style="width: 80%;
height: 25px; border-radius: 10px;border:none; margin-left: 10px; padding: 5px;
margin-top: 10px;">-->  
        </div>
    </div>
</form>
   

</body>
<script>
    function validateform()
    {
        var x= document.forms["myform"]["name1"].value;
        if(x=="")
        {
            alert("Name must be filled out");
            return false;
        }
    }
</script>
</html>

You might also like