Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Learn php tutor needed

Options
13

Comments

  • Registered Users Posts: 172 ✭✭billyduk


    I recommend Chrome as a tutor.

    :D Wonderful! Just wonderful!


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    The lesson would last as long as it would take me to say, "learn python instead ":)


  • Registered Users Posts: 880 ✭✭✭raher1


    ChRoMe wrote: »
    The lesson would last as long as it would take me to say, "learn python instead ":)
    Ok.


  • Registered Users Posts: 880 ✭✭✭raher1


    Talisman wrote: »
    Did you try out the code? Did it work? If not did you try to get it working?
    no,not working.any html?


  • Registered Users Posts: 880 ✭✭✭raher1


    anyone one have a simple crud? with a id session?


  • Advertisement
  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    anyone one have a simple crud? with a id session?

    For what? What are your trying to build? Have you tried any of the PHP examples already posted for you here?


  • Registered Users Posts: 880 ✭✭✭raher1


    Just build a simple book. Create read upload and delete?


  • Registered Users Posts: 2,018 ✭✭✭Colonel Panic


    You're going into "write the code for me" territory.

    I love helping people with programming problems, but only if they've actually tried themselves. There is so much sample code online these days that you can hack anything you want together with those building blocks!


  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    Just build a simple book. Create read upload and delete?

    Ya I know what CRUD stands for. I just have no idea of what it is you are exactly trying to build, what you have tried to date and what level, if any, you are at with your PHP knowledge.

    People will point you in the right direction and review your code to see where you might be going wrong, but nobody is going to build this for you. Especially when you haven't even tried to learn anything for yourself.


  • Registered Users Posts: 880 ✭✭✭raher1


    I don't how to write a MySQL script for a login. I got code. I was thinking I might try something else.


  • Advertisement
  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    I don't how to write a MySQL script for a login. I got code. I was thinking I might try something else.

    Have you tried in any way to learn PHP/SQL at all? There is no magic wand solution for what you are trying to achieve... You NEED to take the time to learn PHP and basic SQL (as has been explained to you at least 5 times in this thread already. I'm not trying to be mean, but you appear to want others to do what you are too lazy to do).

    Nobody is going to help you unless you have first tried to help yourself. Every person on here learned the basics of what they know from a committed period of self-directed learning; taking something they don't know how to build and learning how to build it. What you are trying to achieve is quite simple and there is an ocean of tutorial content online to help you learn. The problem here appears to be your reluctance to commit to learning the basics.

    I'd like to help you but you need to help yourself first.


  • Registered Users Posts: 880 ✭✭✭raher1


    they link up alright but the is nothing outputted. i fiddled with it for a bit. am i missing something obvious.

    welcome.html
    <html>
    <body>



    <form action="welcome.php" method="post">
    Name: <input type="text" name="name"><br>
    E-mail:<input type="text" name="email"><br>
    <input type="submit">
    </form>
    </body>
    <?html>
    welcome.php
    Welcome <?php echo $_POST["name"];?>
    Your email address is: <?php echo $_POST["email"];?>


  • Registered Users Posts: 880 ✭✭✭raher1


    sorry works now.slow server or something


  • Registered Users Posts: 880 ✭✭✭raher1


    will not validate?
    <html>
    <head></head
    <body>
    <?php
    $name = $email = $website = $comment = $gender = "";

    if($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = test_input($_POST["name"]);
    $email = test_input($_POST["email"]);
    $website = test_input($_POST["gender"]);
    $ncomment = test_input($_POST["comment"]);
    $gender = test_input($_POST["website"]);
    }

    function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htnlspecialchars($data);
    return $data;
    }
    ?>

    <h2> PHP FORM VALIDATION EXAMPLE </h2>


    <form method="post" action="<?php echo htmlspecialchars($_SERVERS["PHP_SHELF)"] );?>">
    Name:<input type="text" name="name"><br>
    E-mail:<input type="text" name="email"><br>
    Website: <input type="text" website="website"><br>
    Comment:<textarea name="comment" rows="5" cols ="40"></textarea>

    <br><br>
    Gender:
    <input type="radio" name="gender" value="female">female
    <input type="radio" name="gender" value="male">male
    <br><br>
    <input type="submit">
    <?php
    echo "<h2> Your Input:</h2>";
    echo $name;
    echo "<br>";
    echo $email;
    echo "<br>";
    echo $website;
    echo "<br>";
    echo $comment;
    echo "<br>";
    echo $gender;
    ?>
    </body>
    </html>


  • Technology & Internet Moderators Posts: 28,792 Mod ✭✭✭✭oscarBravo


    raher1 wrote: »
    will not validate?
    Please use
    tags when posting code. [quote] [code]<head></head
    
    [/quote] Missing the closing ">".
    $data = htnlspecialchars($data);
    
    Should be "htmlspecialchars".

    Attention to detail is important when you're coding.


  • Registered Users Posts: 26,558 ✭✭✭✭Creamy Goodness


    will not validate what exactly?

    if it's bad php syntax run
    php -l filename.php
    

    if it's the w3c markup validator (which most use to ensure their html markup will work with majority of browsers) then the php source means nothing to us.

    there are plenty of tools that will tell you the answers better than what we can here. Being honest, in my opinion posting three words 'will not validate' and your source is a sure way not to get people to help you, you've shown no signs of trying to figure it out yourself.


  • Registered Users Posts: 172 ✭✭billyduk


    You have not validated against any conditions. You started with the W3C tutorial template and actually removed the validation they had in their example. Here is an example of how that script validates with comments:
    
    // DEFINE EMPTY VARIABLE FOR ERRORS
    $nameErr = $emailErr = $genderErr = $websiteErr = "";
    
    // DEFINE EMPTY VARIABLE FOR INPUT VALUES
    $name = $email = $gender = $comment = $website = "";
    
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
    
    //IF THE VALUE OF name IN THE FORM IS EMPTY
      if (empty($_POST["name"])) {
    //THE VALUE OF THE VARIABLE $nameErr IS "name is required"
        $nameErr = "Name is required";
      } else {
    //IF THE VALUE IS NOT EMPTY, ASSIGN THE VALUE TO THE VARIABLE $name
        $name = test_input($_POST["name"]);
        //IF THE VARIABLE $name DOES NOT MEET THE CONDITIONS OF A-Z LETTERS WITH ALLOWANCE FOR WHITE SPACE
        if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
    //THEN THE VALUE OF THE VARIABLE $nameErr is ""Only letters and white space allowed"
          $nameErr = "Only letters and white space allowed"; 
        }
      }
    
    

    Also, you need to close the form tag.


  • Registered Users Posts: 880 ✭✭✭raher1


    sorry following 3schools example. just not working.this is all i get.
    Object not found!

    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.
    Error 404
    localhost
    Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7


  • Registered Users Posts: 880 ✭✭✭raher1


    i have tried to work the problem. just not sure what to do. no point messing around.


  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    i have tried to work the problem. just not sure what to do. no point messing around.

    The error is pretty self explanatory. The file you are looking for cannot be found. If the error wasn't obvious enough, did you not think to google what this means?

    Option A.) The path to the file you are trying to open is incorrect.

    Option B.) The file you are trying to open does not exist.

    Option C.) Both Option A.) and Option B.)

    I'm not going to answer any more of these until you at least show a small sign that you searched for a solution yourself. A simple google search would have pointed you in the right direction here.


  • Advertisement
  • Registered Users Posts: 880 ✭✭✭raher1


    It's the way I downloaded the apache xamp. I have to change the config file.


    QUOTE=billyduk;90347027]The error is pretty self explanatory. The file you are looking for cannot be found. If the error wasn't obvious enough, did you not think to google what this means?

    Option A.) The path to the file you are trying to open is incorrect.

    Option B.) The file you are trying to open does not exist.

    Option C.) Both Option A.) and Option B.)

    I'm not going to answer any more of these until you at least show a small sign that you searched for a solution yourself. A simple google search would have pointed you in the right direction here.[/QUOTE]


  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    It's the way I downloaded the apache xamp. I have to change the config file.

    No you don't. Its nothing to do with the way you downloaded XAMP. You just need to make sure the file is in the htdocs directory in your localhost. I wouldn't play around with the config file if you don't know what you are doing.


  • Registered Users Posts: 880 ✭✭✭raher1


    billyduk wrote: »
    No you don't. Its nothing to do with the way you downloaded XAMP. You just need to make sure the file is in the htdocs directory in your localhost. I wouldn't play around with the config file if you don't know what you are doing.


    everything thing works ok. all the variables and functions.
    i follow this url http://localhost/three/validate.php


  • Registered Users Posts: 880 ✭✭✭raher1


    i have got it sorted to this point,lost now. whats wrong,another pair of eyes would be great

    Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\login\registration.php on line 38

    <html>
    <head>

    <?php
    require('connect.php');
    // If the values are posted, insert them into the database.
    if (isset($_POST) && isset($_POST)){
    $username = $_POST;
    $email = $_POST;
    $password = $_POST;

    $query = "INSERT INTO `user` (username, password, email) VALUES ('$username', '$password', '$email')";
    $result = mysql_query($query);
    if($result){
    $msg = "User Created Successfully.";
    }

    ?>
    </head>
    <body>
    <div class="register-form">
    <h1>Register</h1>
    <form action="" method="POST">
    <p><label>User Name : </label>
    <input id="username" type="text" name="username" placeholder="username" /></p>

    <p><label>E-Mail       : </label>
    <input id="password" type="email" name="email" required placeholder="vivek@email.com" /></p>

    <p><label>Password   : </label>
    <input id="password" type="password" name="password" placeholder="password" /></p>

    <a class="btn" href="login.php">Login</a>
    <input class="btn register" type="submit" name="submit" value="Register" />
    </form>
    </div>
    </body>
    </html>


  • Registered Users Posts: 172 ✭✭billyduk


    raher1 wrote: »
    i have got it sorted to this point,lost now. whats wrong,another pair of eyes would be great

    Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\login\registration.php on line 38

    <html>
    <head>

    <?php
    require('connect.php');
    // If the values are posted, insert them into the database.
    if (isset($_POST) && isset($_POST)){
    $username = $_POST;
    $email = $_POST;
    $password = $_POST;

    $query = "INSERT INTO `user` (username, password, email) VALUES ('$username', '$password', '$email')";
    $result = mysql_query($query);
    if($result){
    $msg = "User Created Successfully.";
    }

    ?>
    </head>
    <body>
    <div class="register-form">
    <h1>Register</h1>
    <form action="" method="POST">
    <p><label>User Name : </label>
    <input id="username" type="text" name="username" placeholder="username" /></p>

    <p><label>E-Mail       : </label>
    <input id="password" type="email" name="email" required placeholder="vivek@email.com" /></p>

    <p><label>Password   : </label>
    <input id="password" type="password" name="password" placeholder="password" /></p>

    <a class="btn" href="login.php">Login</a>
    <input class="btn register" type="submit" name="submit" value="Register" />
    </form>
    </div>
    </body>
    </html>


    Whats on line 38 of registration.php?


  • Registered Users Posts: 880 ✭✭✭raher1


    The closing html tags <\html> . I am getting a problem there. I can't see any problem the error is at this point. It wouldn't show up sign in boxes.all I get is error at line 38, the closing html tag.


  • Registered Users Posts: 10,493 ✭✭✭✭28064212


    Two of the first three google results for "unexpected end of file" all contain the answer. Did you try googling it?

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Registered Users Posts: 964 ✭✭✭Greyian


    raher1 wrote: »
    i have got it sorted to this point,lost now. whats wrong,another pair of eyes would be great

    Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\login\registration.php on line 38

    <html>
    <head>

    <?php
    require('connect.php');
    // If the values are posted, insert them into the database.
    if (isset($_POST) && isset($_POST)){
    $username = $_POST;
    $email = $_POST;
    $password = $_POST;

    $query = "INSERT INTO `user` (username, password, email) VALUES ('$username', '$password', '$email')";
    $result = mysql_query($query);
    if($result){
    $msg = "User Created Successfully.";
    }

    ?>
    </head>
    <body>
    <div class="register-form">
    <h1>Register</h1>
    <form action="" method="POST">
    <p><label>User Name : </label>
    <input id="username" type="text" name="username" placeholder="username" /></p>

    <p><label>E-Mail       : </label>
    <input id="password" type="email" name="email" required placeholder="vivek@email.com" /></p>

    <p><label>Password   : </label>
    <input id="password" type="password" name="password" placeholder="password" /></p>

    <a class="btn" href="login.php">Login</a>
    <input class="btn register" type="submit" name="submit" value="Register" />
    </form>
    </div>
    </body>
    </html>

    Just looking at it briefly, you don't seem to be closing your first if-statement.


  • Banned (with Prison Access) Posts: 311 ✭✭Silverbling


    Is the person who is offering php lessons for €20 an hour still here?

    I am self taught and now have 3 php sites, all with different cms, I am quite happy breaking and fixing them, editing files, running sql queries etc.

    I would like to move on a bit and need someone to show me how to adjust the php files I am afraid to touch like the cart, I can add files and adjust them e.g 3rd party credit cards but now I want to move it up a gear with someone sat next to me that can fix it and show me where I went wrong if I make a total cods of it, could you pm me please


  • Advertisement
  • Registered Users Posts: 880 ✭✭✭raher1


    Could you state where exactly it needs closing. I tried closing the last statement three time with varying degrees if unsucces.
    Greyian wrote: »
    Just looking at it briefly, you don't seem to be closing your first if-statement.


Advertisement