www.webdeveloper.com
Results 1 to 11 of 11

Thread: [RESOLVED] php assistance

  1. #1
    Join Date
    Oct 2012
    Posts
    36

    resolved [RESOLVED] php assistance

    Hi all

    I have posted in the html section and i believe that issue is resolved and now i'm having problems with the php of my design, some details to know so it can help answer better, I am using Adobe Dreamweaver CS6, I am only doing this on my computer i have no server set up or hosting site set up just using my local network to see if i can get it to function first.

    I have the following lay out which is now working correctly

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
     .labelclass{
      float: left;
      width: 113px;
     }
    </style>
    </head>
    <body>
    <center>
    <h1>Notes For The Month Of August</h1>
    </center>
    <form name="myform" [B]action="file:///C|/xampp/htdocs/results.php" [/B]target="_blank" method="post">
    <span class="labelclass">Customer Name: </span><input type="text" name="name" /><br />
    <span class="labelclass">Phone Number: </span><input type="text" name="pnumber" /><br />
    <span class="labelclass">E-Mail Address: </span><input type="text" name="eaddy" /><br />
    <span class="labelclass">Issue: </span><input type="text" name="issue" /><br />
    <span class="labelclass">Results: </span><input type="text" name="results" /><br />
    <span class="labelclass">Date: </span><input type="date" name="Date" /><br />
    <input type="submit" name="submit" value="submit"/>
    </body>
    </html>
    I have also through dreamweaver created the following results.php file also as you can see in the html above i have bolded the action to make it go to the results.php page but something is not configured correctly

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>

    </head>

    <body>
    <?php
    if($_POST["submit"]))
    {
        
    $customername $_POST["name"];
        
    $phonenumber $_POST["pnumber"];
        
    $email $_POST["eaddy"];
        
    $issue $_POST["issue"];
        
    $result $_POST["results"];
        
    $date $_POST["Date"];
        
        
        echo 
    "Customer Name: $customername<br />
        Phone Number: 
    $phonenumber<br />
        E-Mail Address: 
    $email<br />
        Issue: 
    $issue<br />
        Results: 
    $result<br />
        Date: 
    $date<br />"

    ?>
    </body>
    </html>
    So the basic concept i am trying to accomplish is that when I click on submit i want it to display the information that i submitted however when i do the following is a result of what happens

    Phone Number: $phonenumber
    E-Mail Address: $email
    Issue: $issue
    Results: $result
    Date: $date
    " } ?>

    as you can see above one issue is that the customer name field is missing and it's not displaying the results correctly

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,304
    Quote Originally Posted by spudly1987 View Post
    Hi all

    I have posted in the html section and i believe that issue is resolved and now i'm having problems with the php of my design, some details to know so it can help answer better, I am using Adobe Dreamweaver CS6, I am only doing this on my computer i have no server set up or hosting site set up just using my local network to see if i can get it to function first.
    ...
    It's being processed by your browser as plain HTML. You need to run it through a web server and access it via "http://localhost" (or however you configure it), not as "file://". It is relatively painless to set up Apache, PHP, and MySQL on your local machine with Wampserver, XAMPP, or a couple other available packages out there. (Wampserver is only for Windows, but as such has some nice features for that environment, otherwise XAMPP works on most popular PC OS's.)

    Once you get that running, you'll then find you've forgotten the terminal semi-colon on the echo command.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2012
    Posts
    36
    NogDog

    Thank you for that information, I do have Xampp installed on the computer however i have no clue how to use the program, any chance you can walk me through it? if you dont mind that is

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,346
    Find the XAMPP control panel, run the program, it will list what services are running, if you can see that your Apache server is running, then open a web browser an type in http://localhost/xampp and your xampp config should show up.

    It is at that point you will know if the xampp install is fully operational or not, because if you have the servers running and can't access the webserver, you have some tweaking to do and it would be best to consult the Apache friends site on rectifying that issue.

    If all is working, then you only need find the install path of XAMPP and this is usually a path like C:\xampp\htdocs\ and in side that you find xampp folder, if you see an xampp folder than youre in the right place, make a folder called site, put your index.php page in that folder, go to your web browser and type http://localhost/site and hit enter, your page should show up.

    My XAMPP install is in this path, I create a folder and view in this manner... adapt for your particular install.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  5. #5
    Join Date
    Oct 2012
    Posts
    36
    Do i paste both the .html and the .php in the same site folder, i just did the results.php file in the site folder and it is appearing as such

    Index of /site

    [ICO] Name Last modified Size Description
    [PARENTDIR] Parent Directory -
    [TXT] results.php 2013-08-14 11:00 767
    Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16 Server at localhost Port 80

    so not sure what i'm doing wrong

  6. #6
    Join Date
    Oct 2012
    Posts
    36
    and then when i click on results.php i get this error

    Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\site\results.php on line 11

  7. #7
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,304
    Quote Originally Posted by spudly1987 View Post
    and then when i click on results.php i get this error

    Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\site\results.php on line 11
    Good. That means the PHP parser is running. Now you need to add the missing semicolon I mentioned in my first reply.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  8. #8
    Join Date
    Oct 2012
    Posts
    36
    so i go echo; then the rest or how do i do that, having a brain fart

  9. #9
    Join Date
    Oct 2012
    Posts
    36
    Actually scratch that last post, i got it to work, so now i have it to display correctly.

    my next question if there is any way you amazing people can give me assistance is, is there anyway that i can make it save the information and then be able to go back and put in another set of information and then save that so it keeps adding to it instead of over writing it?

    for example

    Customer 1
    text
    text
    text
    text
    text

    then input customer two

    customer 2
    text
    text
    text
    text
    text

    so then when i view the results it will have both
    customer 1 and customer 2 information

    if this makes any sense

  10. #10
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,304
    That's typically where a database comes into play -- not something easily explained in a quick reply here.

    If you expect very limited traffic/usage, you could "cheat" and just append data to a text file, using PHP's assorted file-handling functions.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  11. #11
    Join Date
    Oct 2012
    Posts
    36
    Yeah it will only be limited to only me doing it and maybe 10 customers at most not even

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles