Page 6 of 7 FirstFirst ... 34567 LastLast
Results 61 to 72 of 77

Thread: PHP MySQL Class-11

  1. #61
    dar-us-slam is offline Junior Member
    Last Online
    9th February 2012 @ 10:20 PM
    Join Date
    13 Sep 2011
    Age
    38
    Gender
    Male
    Posts
    26
    Threads
    0
    Credits
    965
    Thanked
    0

    Default

    Jazak Allah.

  2. #62
    Join Date
    20 Jun 2012
    Location
    Khuzdar
    Age
    32
    Gender
    Male
    Posts
    40
    Threads
    1
    Credits
    0
    Thanked: 1

    Default

    Nice

  3. #63
    zinda bad is offline Junior Member
    Last Online
    24th January 2015 @ 06:06 PM
    Join Date
    26 Jan 2011
    Gender
    Male
    Posts
    16
    Threads
    1
    Credits
    0
    Thanked
    0

    Default

    ASSALAM O ALYKUM SIR G,
    PHP KI CLASS KA BOHAT BOHAT SHUKRIA.
    mein is waqt xampp-win32-1.7.4-VC6-installer use kar raha hoon jis mein class 11, page 13 per use kiye gaee array ko cleanStr function mein se guzarein to error generate hota he.
    foreach($ar as $key => $value){
    $value = cleanStr($value);
    error: trim() expects parameter 1 to be string, array given in (path of file)\application.php on line 7.
    agar is 1 line ko ignore kar dia jai
    // $value = cleanStr($value);
    to form theek ho jata he is k ilawa b neechay agar male ya female ko select na kia gaya ho to error generate hota he.
    error:
    Notice: Undefined index: gender in (file path)\application.php on line 55

    Notice: Undefined index: skills in (filepath)\application.php on line 60.
    in masail ka hal mein ne search karne k bad ye nikala he k cleanStr ko array pr na use kia jai r $gender r $skills se pehlay @ ka izafa kar dia jai. kuch is tarah
    @$gender = $_POST['gender'];
    @$skills = $_POST['skills'];
    @ wala solution waqaee work karta he.
    ap se is k side effects ka poochna he k aaya @ use karne se koi problem to nahi hogi.
    Apki Help ka bohat bohat shukria.

  4. #64
    Qasim Shehzad is offline Junior Member
    Last Online
    14th June 2014 @ 02:13 AM
    Join Date
    26 Jan 2007
    Age
    37
    Posts
    5
    Threads
    0
    Credits
    960
    Thanked
    0

    Default

    Thanks Shakel Bhai

  5. #65
    shohaz's Avatar
    shohaz is offline Senior Member
    Last Online
    17th February 2019 @ 04:05 PM
    Join Date
    21 Dec 2012
    Location
    karachi
    Gender
    Male
    Posts
    1,306
    Threads
    37
    Credits
    97
    Thanked
    41

    Default

    nice

  6. #66
    sobia aslam is offline Senior Member+
    Last Online
    19th June 2020 @ 03:47 PM
    Join Date
    02 Jun 2013
    Location
    gojra
    Age
    32
    Gender
    Female
    Posts
    227
    Threads
    8
    Credits
    50
    Thanked
    13

    Default hi

    thanks

  7. #67
    muslimrao's Avatar
    muslimrao is offline Junior Member
    Last Online
    18th June 2013 @ 11:13 AM
    Join Date
    20 Aug 2008
    Age
    35
    Posts
    17
    Threads
    3
    Credits
    950
    Thanked
    0

    Default

    Hello zinda bad,

    cleanStr ka jo custom function hai wo string kay liyay hi hai.. array kay liyay nahi. and dosri baat. @ warnings and errors ko hide karnay kay liyay hota hai.. best practice ye hai kay ap @ use na karein. but jahan kafi bari application ki baat hoti hai wahan @ use karna par jata hai. but ap ki condition mei @ ki need nahi. ap koshish karein kay error ko debug karein.

  8. #68
    zebzeb's Avatar
    zebzeb is offline Senior Member+
    Last Online
    29th April 2019 @ 08:52 PM
    Join Date
    22 Jul 2012
    Location
    dubai
    Age
    44
    Gender
    Male
    Posts
    47
    Threads
    9
    Credits
    60
    Thanked: 1

    Default

    best hy

  9. #69
    irfanali21 is offline Junior Member
    Last Online
    19th December 2015 @ 07:57 AM
    Join Date
    09 Feb 2010
    Age
    35
    Posts
    5
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    Quote shakeel said: View Post
    .
    here is some problem with this code isemptyFields() function $value=cleanstr($value) remove this line you will not get any error.

  10. #70
    irfanali21 is offline Junior Member
    Last Online
    19th December 2015 @ 07:57 AM
    Join Date
    09 Feb 2010
    Age
    35
    Posts
    5
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    Quote irfanali21 said: View Post
    here is some problem with this code isemptyFields() function $value=cleanstr($value) remove this line you will not get any error.
    i have attache the form.html for layout code of this class
    //app.php code for this file
    <?php
    function cleanStr($str)
    {
    $cStr=trim($str);
    $cStr=htmlspecialchars($cStr);
    $cStr=addslashes($cStr);
    return $cStr;
    }
    function emptyFields($ar)
    {
    if(!is_array($ar))
    {
    print "The argument must be an Array";
    return false;
    }
    foreach($ar as $key => $value){
    if(empty($value))
    {
    print "<b>".ucwords($key)."</b> Must not be empty.please click the browser
    back button and correct it";
    return false;
    }
    }
    return true;
    }
    if(!emptyFields($_POST)){
    exit();
    }
    function isEligible($skills,$age){
    $age=intval($age);
    if(count($skills)==0){
    print ("you donot have any skill");
    return false;
    }
    if($age<23 ||$age>35){
    print ("your age must be between 23 and 35");
    return false;
    }
    return true;
    }

    $name=cleanStr($_POST['name']);
    $phone=cleanStr($_POST['phone']);
    $email=cleanStr($_POST['email']);
    $address=cleanStr($_POST['address']);
    $gender=$_POST['gender'];
    $city=$_POST['city'];
    $age=(int)cleanStr($_POST['age']);
    $skills=$_POST['skills'];
    if(!isEligible($skills,$age)){
    exit();
    }
    print "<h4>Thank you ".$name." for your interset in this job.we will contact you soon.</h4>";
    print "We have recived following Information about you.<br/>";
    print "Name : ".$name."<br/>";
    print "Phone : ".$phone."<br/>";
    print "Email : ".$email."<br/>";
    print "Address : ".$address."<br/>";
    print "Gender : ".$gender."<br/>";
    print "City : ".$city."<br/>";
    print "Age : ".$age."<br/>";
    print "your skills : ";
    foreach($skills as $value){
    print $value.",";
    }
    ?>
    Attached Files Attached Files

  11. #71
    SK Balti's Avatar
    SK Balti is offline Senior Member+
    Last Online
    12th July 2020 @ 04:37 PM
    Join Date
    22 Jan 2012
    Location
    Karachi
    Gender
    Male
    Posts
    450
    Threads
    21
    Credits
    46
    Thanked
    17

    Default

    Thanks alot Shakeel bhaie

  12. #72
    syed.vkax is offline Junior Member
    Last Online
    19th August 2014 @ 11:55 AM
    Join Date
    16 Jul 2014
    Age
    39
    Gender
    Male
    Posts
    1
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    sir, mujhy is program ko run karny mai error ka samna karna par raha hai. jub main form.html mai submit per click karta hon tu wo mujhy ye error daita hai

    Notice: Undefined variable: cstr in D:\xampp\htdocs\application.php on line 5

    Notice: Undefined variable: cstr in D:\xampp\htdocs\application.php on line 6

    jab k mai ye code likh raha hon.

    <?php
    //clean white spaces and special characters from values
    function cleanStr($str){
    $cStr = trim ($str);
    $cStr = htmlspecialchars($cstr);
    $cStr = addslashes($cstr);
    return $cStr;
    }
    ?>

    Plz help..

Page 6 of 7 FirstFirst ... 34567 LastLast

Similar Threads

  1. PHP MySQL Class-7
    By shakeel in forum PHP MySQL
    Replies: 97
    Last Post: 18th August 2016, 01:02 PM
  2. PHP MySQL Class-12
    By shakeel in forum PHP MySQL
    Replies: 60
    Last Post: 10th August 2016, 11:48 AM
  3. PHP MySQL Class-18
    By shakeel in forum PHP MySQL
    Replies: 71
    Last Post: 9th April 2016, 04:07 PM
  4. PHP MySQL Class-20
    By shakeel in forum PHP MySQL
    Replies: 83
    Last Post: 28th August 2015, 05:25 PM
  5. MySql first class
    By aajizUsmani in forum Courses
    Replies: 4
    Last Post: 23rd March 2014, 02:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •