Jump to content

plodos

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by plodos

  1. <form>
    <select name="contact">
    
    <option value="List">List</option>
    <option value="Plen">Plen</option>
    
    </select>
    
    
    <!-- if the variable "List" is sent then display the field -->
    
    <?php if(isset($_GET['List'])){?>
    
    <td>Code</td>
    
    <td>
    <input name="add list" type="text" id="add list" value="<?php echo $_GET['add list'];?>" size="28"/></td> 
    
    <?php ;}?>
    
    </form>
    

     

    If the user select the "List" from the combobox, From will add "add list" input field, this must be visible/appeared in the form...

     

    If user select "Plen", there is no need to show "add list" field...

     

    You understood what I mean :)

     

    But this code is not working, I didnt do it....How can do it?, Who knows the true code..Pls help me

  2. verificationimage.php

    <?php
    header('Content-type: image/jpeg');
    
    $width = 50;
    $height = 24;
    
    $my_image = imagecreatetruecolor($width, $height);
    
    imagefill($my_image, 0, 0, 0xFFFFFF);
    
    // add noise
    for ($c = 0; $c < 40; $c++){
    $x = rand(0,$width-1);
    $y = rand(0,$height-1);
    imagesetpixel($my_image, $x, $y, 0x000000);
    }
    
    $x = rand(1,10);
    $y = rand(1,10);
    
    $rand_string = rand(1000,9999);
    imagestring($my_image, 5, $x, $y, $rand_string, 0x000000);
    
    setcookie('tntcon',(md5($rand_string).'a4xn'));
    
    imagejpeg($my_image);
    imagedestroy($my_image);
    ?>
    

     

    Im using this link for show the image....

    <img src="verificationimage.php?<?php echo rand(0,9999);?>" width="50" height="24" align="absbottom" />

     

    At the before I didnt see any problem..when I changed my hosting company, this script is not show anything(JPEG files)

    What can be the reason?

  3. index.html

    <a href=”country_list.html#bulgaria”>Click for Bulgaria </a>
    <a href=”country_list.html#greece”>Click for Greece </a>
    

     

    country_list.html

    <html>
    greece
    xxxxxx
    aaaaaa
    bbbbbb
    tttttttt 
    .........
    bulgaria
    .........
    .........
    .........
    .........
    .........
    </html>
    

     

    Sometimes, I see the some codes like #top #bottom #center

     

    bulgaria information is center of the coutry_list.html...

     

    If the user click the bulgaria in the index page.....user will directly go to bulgaria which is center in the country_list.html

    but I dont know how to do it :S

     

    who can give me the example, pls...

  4. index.html

    <a href=”htmllink.html#bulgaria”>Click for Bulgaria </a>
    <a href=”htmllink.html#greece”>Click for Greece </a>

     

    country_list.html

    <html>
    greece
    xxxxxx
    aaaaaa
    bbbbbb
    tttttttt 
    .........
    bulgaria
    .........
    .........
    .........
    </html>
    

    Sometimes, I see the some codes like #top #bottom #center

     

    bulgaria information is center of the coutry_list.html...

    If the user click the bulgaria in of the index page.....user will directly go to bulgaria center in the country_list.html

    but I dont know how to do it :S

     

    who can give me the example, pls...

  5. <script LANGUAGE="JavaScript">
    <!--
    function ValidateForm(form){
    ErrorText= "";
    if ( form.age.selectedIndex == 0 ) 
    { 
    alert ( "Please select your Age." ); return false; 
    }
    if (ErrorText= "") 
    { 
    form.submit() }
    }
    -->
    </script>
    
    <form name="feedback" action="mailto:aaa@aaa.com" method=post   onSubmit="ValidateForm(this.form)">
    Your Age: <select name="age"> 
    <option value="">Please Select an Option:</option> 
    <option value="0-18 years">0-18 years</option> 
    <option value="18-30 years">18-30 years</option> 
    <option value="60+ years">60+ years</option> 
    </select>
    <input type="button" name="SubmitButton" value="Submit">
    <input type="reset" value="Reset">
    </form>

    I want to validate the combobox is selected or not...but onSubmit is not working :S

    I have already onclick evet I dont know how to combine two onclick event in one function:S

     

    What can be the errors..I couldnt find it :s

  6. of course I used trim and empty...but problem is, I didnt write the code

    maybe conditions has problem .. this is another one...

    original script is working..but when I want to seperate..its not working :s

    who can help me for the coding part...

    <?php
    $name = $_POST[name];
    $surname = $_POST[surname];
    $email = $_POST[email];
    $msg_title = "alert";
    $to="alert@xxx.com";
    $file = $_POST[fileatt];
    $check = trim($file);
    
    if (empty($check))
    {
    just send email........ mail();
    }
    
    else {
    
    $message= '
    <table width="522" height="235" border="1">
      <tr>
        <td>Name Surname </td>
        <td>'.$name.' '.$surname.'</td>
      </tr>
    </table>';
    
      // Obtain file upload variables
                $fileatt      = $_FILES['fileatt']['tmp_name'];
                $fileatt_type = $_FILES['fileatt']['type'];
                $fileatt_name = $_FILES['fileatt']['name'];
    
                $headers = "From: $email  \n";
    //upload file type
    $FILE_EXTS = array('.txt'); 
    $file_name = $_FILES['fileatt']['name'];
    $file_ext = strtolower(substr($file_name,strrpos($file_name,".")));
    if (!in_array($file_ext, $FILE_EXTS)){
    include 'problem.html';
    exit();
    }
    
               // if($_FILES['fileatt']['size'] > 0)
               if (is_uploaded_file($fileatt)) {
               // Read the file to be attached ('rb' = read binary)
                $file = fopen($fileatt,'rb');
                $data = fread($file,filesize($fileatt));
                fclose($file);
                // Generate a boundary string
                $semi_rand = md5(time());
                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
                // Add the headers for a file attachment
                $headers .= "MIME-Version: 1.0\n" .
                            "Content-Type: multipart/mixed;\n" .
                            " boundary=\"{$mime_boundary}\"";
                // Add a multipart boundary above the  message
                $message = "This is a multi-part message in MIME format.\n\n" .
                "--{$mime_boundary}\n" .
                "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
                "Content-Transfer-Encoding: 7bit\n\n" .
                $message . "\n\n";
    
                // Base64 encode the file data
                $data = chunk_split(base64_encode($data));
                 // Add file attachment to the message
                $message .= "--{$mime_boundary}\n" .
                "Content-Type: {$fileatt_type};\n" .
                " name=\"{$fileatt_name}\"\n" .
                //"Content-Disposition: attachment;\n" .
                //" filename=\"{$fileatt_name}\"\n" .
                "Content-Transfer-Encoding: base64\n\n" .
                $data . "\n\n" .
                "--{$mime_boundary}--\n";
                 }else echo "File error!  ";
    
                if(mail($to,$msg_title,$message,$headers)) 
                {
                	include'ok.html';
                }
                else
                { 
                	include 'problem.html';
                }
    }
    ?>
    

  7. I have a form like that ( email form with attachment)

    <?php
    $name = $_POST[name];
    $surname = $_POST[surname];
    $email = $_POST[email];
    $msg_title = "alert";
    $to="alert@xxx.com";
    
    $message= '
    <table width="522" height="235" border="1">
      <tr>
        <td>Name Surname </td>
        <td>'.$name.' '.$surname.'</td>
      </tr>
    </table>';
    
      // Obtain file upload variables
                $fileatt      = $_FILES['fileatt']['tmp_name'];
                $fileatt_type = $_FILES['fileatt']['type'];
                $fileatt_name = $_FILES['fileatt']['name'];
    
                $headers = "From: $email  \n";
    //upload file type
    $FILE_EXTS = array('.txt'); 
    $file_name = $_FILES['fileatt']['name'];
    $file_ext = strtolower(substr($file_name,strrpos($file_name,".")));
    if (!in_array($file_ext, $FILE_EXTS)){
    include 'problem.html';
    exit();
    }
    
               // if($_FILES['fileatt']['size'] > 0)
               if (is_uploaded_file($fileatt)) {
               // Read the file to be attached ('rb' = read binary)
                $file = fopen($fileatt,'rb');
                $data = fread($file,filesize($fileatt));
                fclose($file);
                // Generate a boundary string
                $semi_rand = md5(time());
                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
                // Add the headers for a file attachment
                $headers .= "MIME-Version: 1.0\n" .
                            "Content-Type: multipart/mixed;\n" .
                            " boundary=\"{$mime_boundary}\"";
                // Add a multipart boundary above the  message
                $message = "This is a multi-part message in MIME format.\n\n" .
                "--{$mime_boundary}\n" .
                "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
                "Content-Transfer-Encoding: 7bit\n\n" .
                $message . "\n\n";
    
                // Base64 encode the file data
                $data = chunk_split(base64_encode($data));
                 // Add file attachment to the message
                $message .= "--{$mime_boundary}\n" .
                "Content-Type: {$fileatt_type};\n" .
                " name=\"{$fileatt_name}\"\n" .
                //"Content-Disposition: attachment;\n" .
                //" filename=\"{$fileatt_name}\"\n" .
                "Content-Transfer-Encoding: base64\n\n" .
                $data . "\n\n" .
                "--{$mime_boundary}--\n";
                 }else echo "File error!  ";
    
                if(mail($to,$msg_title,$message,$headers)) 
                {
                	include'ok.html';
                }
                else
                { 
                	include 'problem.html';
                }
    //}
    ?>

     

    I need to control if

    <input name="fileatt" type="file" id="fileatt" size="60">

    "fileatt" is posted empty or not...

     

    if "fileatt" is empty or null send email without upload...

     

    but if fileatt has some value  send it with attachment...

     

    I dont know how many if else combination I tested....like

     

    $a = $_POST[fileatt];

     

    if($a=="" | $a==NULL)

    send email without attachment

    else

    send with attachment

     

    I want to do this...Pls help :s

  8. $to = $_REQUEST["email"];
    $title = $_REQUEST["title"];
    $from= "info@xxx.com";
    $content = "Advertisement";
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "To: $to\r\n";
    $headers .= "From: $from\r\n";
    
    mail($to,$subject,$content,$headers);
    

    script is getting the receiver email ($to) and

    inside of the headers $to(josh@asd.com) and $from(nfo@xxx.com)

     

    Problem is that......when I send the email josh@asd.com also script is automaticaly sending the email to me info@xxx.com..!!!!

     

    I dont want to take a copy of this email in this email box info@xxx.com..but sender must see the From: part....what must I do....???

  9. Error is

    Not Found

    The requested URL /add.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

     

    İm trying to learnd $_GET method....Whats the error, I didnt see...Pls help

    a.php

    if($add_person)
    {	header('Location: http://www.xxx.com/add.php?cpage='.$count_commit.'     ');
    }

    b.php

    <?php
    include("dbconfig.php");
    
    switch($_GET['cpage']) {
        case "1":
            check(1);
            break;
        case "2":
          check(2);
            break;
        default:
        	echo "error";
    }
    
    function check($number){
    $search = $number;
    
    $data = mysql_query("select p.*
                         from join_person_committee j, person p
                         where j.person_id = p.person_id AND j.person_id='$search'
                         ORDER BY p.person_id ASC LIMIT $baslangic,$limit"); 
    
    while($info=mysql_fetch_array($data))
    {
    	echo"			{$info['university']}<br>";
    }
    
    }}
    ?>
    

  10. How can I do that link...

    paged=2 & s=xxxx

    I need to make this, than I will control with switch but what is the name of this ......

    how will I search on the google for learn...or if you have sample code, could you share it...

    like : www.2checkout.com/community/?paged=2&s=xxxxxx
    

  11. sorry but

    i didnt understand the solution way?

     

    $dd_name=$_SESSION['PassWord'];
    $sql = "select d_name from doctor where password='$dd_name'  ";
    $id = mysql_query($sql);
    echo $id;

    $dd_name=$_SESSION['PassWord'];
    $sql = "select d_id from doctor where password='$dd_name'  ";
    $id = mysql_query($sql);
    echo $id;

    if I write like that....Output is only Resource id #4

     

    What must I write for see the true result...??

     

  12. $sql="SELECT d_name,password FROM doctor WHERE d_name='$myusername' and password='$mypassword'";
        $result=mysql_query($sql);
        // Mysql_num_row is counting table row
        $count=mysql_num_rows($result);
        // If result matched table row must be 1 row
        if($count==1){
    	$_SESSION['loggedInD'] = true;
    	$_SESSION['UserName'] = $myusername;
    	$_SESSION['PassWord'] = $mypassword;
    	header('location:doctor.php?'.SID.'');
    }
    

    There is a problem

    <?
    session_start();
    include("dbconfig.php");
    if (!$_SESSION['loggedInD']) 
    {
    header("location:login.php"); 
    die ();
    }
    else
    { 
    $dd_name=$_SESSION['PassWord'];
    $sql = "select d_id from doctor where password like  '%$dd_name%'  ";
    echo mysql_query($sql);
    echo "\n";
    echo $sql;
    }
    

    output is like that

    Resource id #5 select d_id from doctor where password like '%lukeW%' 

    but LUKE ID is 1...

     

    $dd_name=$_SESSION['PassWord']; //this is working..

    but there is a problem here, $sql = "select d_id from doctor where password like  '%$dd_name%'  ";

    im my opinion, we can use the session variables in the SQL querys..

     

    What can be the error?

  13. .sql

    CREATE TABLE department (
       dept_id INT NOT NULL,
       dept_name TEXT,
       PRIMARY KEY (dept_id)
    );
    
    DROP TABLE IF EXISTS proficiency;
    
    CREATE TABLE proficiency (
       p_id INT NOT NULL, 
       p_name TEXT NOT NULL,
       PRIMARY KEY (p_id)
    );
    
    DROP TABLE IF EXISTS doctor;
    
    CREATE TABLE doctor (
       d_id INT NOT NULL PRIMARY KEY,
       d_name varchar(50) NOT NULL,
       d_surname VARCHAR(50) NOT NULL,
       d_add TEXT NOT NULL,
       SSN INT(4) NOT NULL, 
       d_tel INT(4) NOT NULL,
       d_bdate DATETIME NOT NULL,  # 2003-03-31 11:22:12
       p_id INT NOT NULL,          
       dept_id INT NOT NULL,
       password VARCHAR(50) NOT NULL,
       FOREIGN KEY (dept_id) REFERENCES department (dept_id),
       FOREIGN KEY (p_id) REFERENCES proficiency (p_id)    
    );

     

    I want to update the doctor information, like proficiency or password

    trick point is multiple querys :)

    this is my query...whats wrong...

    $_u ="UPDATE doctor dr, proficiency p, department d 
    					SET  dr.d_id = '$id',
    					     dr.d_name='$_d_name', 
    					     dr.d_surname='$_d_surname', 
    					     dr.d_add='$_d_add',
    					     dr.SSN='$_SSN', 
    					     dr.d_tel='$_d_tel', 
                                                         dr.d_bdate='$_d_bdate',
                                                         p.p_id='$prof_id',
                                                        dr.dept_id='$dept_id',
                                                        dr.password = '$password'
                                
    					WHERE dr.d_id ='$id'    AND 
    					d.dept_id = '$dept_id'  AND
    					p.p_id = '$prof_id'     AND dr.dept_id = d.dept_id AND dr.p_id = p.p_id ;";
    
    $query=mysql_query($_u);
    

    I test the $query....there is no error.....but it is not recording the data

  14. $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";
    

     

    I delete this line

    AND pt_surname like '%".$surname."%'

     

    now, the script is working correctly but only searching the name

     

    but 

    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";  
    echo $query; // new line
    

    output like that select * from patient where pt_name=laura AND pt_surname=

    surname is blank...

     

  15. hımm..I need :)

     

    everything is possible, if you are good programmer:) but I didnt find the solution to GET ID..

     

    Maybe there is a another way to compare the strings in the _update.php page...

    If the strings are equal, try to get the ID :) try:)

     

    But also I want to learn this way, by the help of simple form, send the SELECTED ID....???? 

  16. $name      = $HTTP_POST_VARS['name'];
    $surname   = $HTTP_SERVER_VARS['surname'];
      
    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";  
    
    
    Print "<table border cellpadding=1>";
    
    $data = mysql_query($query); 
    while($info=mysql_fetch_array($data))
    {
    Print "<tr>";
    Print "<th>Patient ID:</th> <td>{$info['pt_id']}</td> ";
    Print "<th>Name:</th> <td>{$info['pt_name']}</td> ";
    Print "<th>Surname:</th> <td>{$info['pt_surname']}</td> ";
    Print "<th>SSN:</th> <td>{$info['pt_SSN']}</td> ";
    Print "<th>Add:</th> <td>{$info['pt_add']} </td>";
    Print "<th>Tel:</th> <td>{$info['pt_tel']} </td>";
    Print "<th>Blood:</th> <td>{$info['pt_blood']} </td>";
    Print "<th>Visit Date:</th> <td>{$info['pt_visit']} </td>";
    echo "<td><a href=\"_edit.php?id=".$info['pt_id']."\"> EDIT </a>";
    Print"</tr>";
    }
    
    Print "</table>"; 
    

    it gives an error like mysql_fetch_array() supplied ..... why ?

  17. if I write this sentence

    select * from patient  where pt_name like '%laura%' AND pt_surname like '%sams%'
    

    php script is working...

     

    but if I write

    $name      = $HTTP_POST_VARS['name'];

    $surname  = $HTTP_POST_VARS['surname'];

     

    $name = addslashes($name);

    $surname = addslashes($surname);

     

    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";

    page shows nothing...why ?

  18. $name      = $HTTP_POST_VARS['name'];
    $surname   = $HTTP_SERVER_VARS['surname'];
      
    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";  
    
    
    Print "<table border cellpadding=1>";
    
    $data = mysql_query($query); 
    while($info=mysql_fetch_array($data))
    {
    Print "<tr>";
    Print "<th>Patient ID:</th> <td>{$info['pt_id']}</td> ";
    Print "<th>Name:</th> <td>{$info['pt_name']}</td> ";
    Print "<th>Surname:</th> <td>{$info['pt_surname']}</td> ";
    Print "<th>SSN:</th> <td>{$info['pt_SSN']}</td> ";
    Print "<th>Add:</th> <td>{$info['pt_add']} </td>";
    Print "<th>Tel:</th> <td>{$info['pt_tel']} </td>";
    Print "<th>Blood:</th> <td>{$info['pt_blood']} </td>";
    Print "<th>Visit Date:</th> <td>{$info['pt_visit']} </td>";
    echo "<td><a href=\"_edit.php?id=".$info['pt_id']."\"> EDIT </a>";
    Print"</tr>";
    }
    
    Print "</table>"; 
    

    it gives an error like mysql_fetch_array() supplied ..... why ?

  19. <?php 
    <form action="_update.php" method="post" id="_editform" >
       echo'<select name="proficiency">';
       $res=mysql_query("select * from proficiency");
       if(mysql_num_rows($res)==0)
       {
       echo "there is no data in table..";
       }
       else
       {
       while ($row = mysql_fetch_assoc($res) )
       {
       $id = $row['p_id'];
    $name = $row['p_name'];
    print "<option id='$id'>$name</option>\n";
        }
        }
    echo'</select>';
    
    <input type="submit" name="Submit" value="SAVE ">
    </form>
    ?>
    

    _update.php

    $_POST['proficiency']; it only shows the selected name...not for me ! ....
    

     

    How can I take the SELECTED INDEX NUMBER..I used form..This form will send only the selected ID...

    this is my proficiency table.....

    1 PROF. DR

    2 DOC. DR

    3 ASS. PROF. DR

    4 DR

     

     

  20. <?php 
    <form action="_update.php" method="post" id="_editform" >
      	echo'<select name="proficiency">';
      	$res=mysql_query("select * from proficiency");
      	if(mysql_num_rows($res)==0)
      	{
      		echo "there is no data in table..";
      	}
      	else
      	{
      		while ($row = mysql_fetch_assoc($res) )
      		{
      		$id = $row['p_id'];
    	$name = $row['p_name'];
    	print "<option id='$id'>$name</option>\n";
        }
        }
    echo'</select>';
    
    <input type="submit" name="Submit" value="SAVE ">
    </form>
    ?>

     

    _update.php

    $_p_id    = $_POST['proficiency'];    // it show the selected name            
    

    How can I take the OPTON ID 

    $_p_id    = $_POST['id']; //it is not working

       

  21. Dbase department

    CREATE TABLE department (
       dept_id INT NOT NULL,
       dept_name TEXT,
       PRIMARY KEY (dept_id)
    );
    

    combobox code

    <?php 
      echo'<select name="department">';
      $res=mysql_query("select * from department");
      if(mysql_num_rows($res)==0) 
      echo "there is no data in table..";
      else
      for($i=1;$i<=mysql_num_rows($res);$i++) {
      $row=mysql_fetch_assoc($res);
      echo"<option>$row[dept_name]</option>";
      }
    echo'</select>';
    ?>
    

     

    it is listing the department names....but I need to take IDs...

     

    1 PEDIATRICS

    2 DIABETES

    3 CARDIOLOGY

     

    How to use selectedIndex or how can I get the number of selected ındex

  22. Dbase department

    CREATE TABLE department (
       dept_id INT NOT NULL,
       dept_name TEXT,
       PRIMARY KEY (dept_id)
    );
    

    combobox code

    <?php 
      echo'<select name="department">';
      $res=mysql_query("select * from department");
      if(mysql_num_rows($res)==0) 
      echo "there is no data in table..";
      else
      for($i=1;$i<=mysql_num_rows($res);$i++) {
      $row=mysql_fetch_assoc($res);
      echo"<option>$row[dept_name]</option>";
      }
    echo'</select>';
    ?>
    

     

    it is listing the department names....but I need to take IDs...

     

    1 PEDIATRICS

    2 DIABETES

    3 CARDIOLOGY

     

    How to use selectedIndex or how can I get the number of selected ındex

×
×
  • Create New...

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.