Testing PHP Code

Hello there,
I'm in the process of creating a website for myself, I've
included a small peice of PHP for a feedback page, the email the
from results to me. However, I shalln't be buying my domain and
hosting until I complete the page (I'm hoping by the end of the
month). Now, does anybody know how I can test the PHP without
having to upload it to the internet.
All the best,
Kristopher (UK).

On Fri, 10 Aug 2007 20:17:15 +0000 (UTC), "MikeL7"
<[email protected]> wrote:
>I would also recommend buying a book that includes
setting up MySQL and Apache
>for PHP, I looked at Davids book at the bookstore and if
your using CS3 it has
>a lot of good examples, i am sure there is one for DW8
to.
I'd suggest this one:
http://foundationphp.com/dreamweaver8/index.php
It includes well written, very comprehensive instructions for
installing
Apache, PHP, and MySQL. If you go that way, be sure to check
the changes
that have been made to some of those programs since the
book's
publication:
http://foundationphp.com/dreamweaver8/updates.php
Gary

Similar Messages

  • Php code is not working as intended in a simple spam block solution

    Hi. I'm trying to get some simple php code (as suggested on a tutorial page I found) to work on my form submission test page in order to reduce/stop spam. However, the results so far have not quite been what I expected. Any help will be appreciated.
    Basically I used the code given in the two grey boxes on this tutorial page http://myphpform.com/form-spam.php (but had to add this <?php ... ?> around the code given in the second box, otherwise it wouldn't have worked!) for my test page, and the result was supposed to look something like shown on this page http://myphpform.com/contact.php and indeed when I previewed my page in offline mode it displayed as intended with the extra field similar to the "Access code:" as on this example page, however that's not what I got when I uploaded my page.
    What happens when I go to the live page is that as soon as it loads it gives me the message: "Wrong access code" before I even have a chance to look at the form there. It's the message the user is supposed to get when they input the suggested code incorrectly, but not when the page first loads! This is what the live test page basically looks like when I go to it http://www.scotiauk.com/contact/forms/smotsContactTest.php. I wonder what's going wrong?
    I actually noticed a short while ago, after 'viewing page source' (source code) on the live test page that the page is for some reason only displaying less than half of the html code and cuts off the rest of it (including all of the <body>) just at the point (at the end of the <head> section) where the couple of lines of php script (borrowed from the second grey box in the tutorial) were meant to be - the script that includes "Wrong access code". So I get why it shows a blank page with only that message in it but not why it removes all of the <body> code once it is live!
    Just for information, this is what the page is really meant to look like - minus the php code: http://www.scotiauk.com/contact/forms/smotsContact.html. That is the original page that I copied and tried to modify with the new code. So, any ideas will be appreciated, thanks!

    Just for information, this is what the page is really meant to look like - minus the php code: http://www.scotiauk.com/contact/forms/smotsContact.html. That is the original page that I copied and tried to modify with the new code. So, any ideas will be appreciated, thanks!
    The page that you have quoted contains an infection as the following warns.
    As far as your problem is concerned, you need to know how a from works. Have a look at this video.

  • Is there any A/B testing setup code in dreamweaver?

    I am trying to setup A/B testing.  I am not a coder but I know there are solutions in Wordpress.  How do you setup A/B testing using php code?

    http://phpabtest.com/
    Nancy O.

  • How to get pdf form data into a php code?

    I have created one pdf form ,that helps to fill application form online.....
    I tried to access the field values using php code ($_REQUEST) but itz not taking any field values then i searched everywer to find solution but all are telling the same .then i got one link for demo of simple submit form , here is the demo http://blogs.adobe.com/stevex/files/SimpleSubmitSample.pdf but this demo is not working in my system,not getting values from pdf ........................Is there any setting to do inorder to get pdf form field values in PHP
    can any one help me??

    I never had this problem so obviously something needs tweaking. First thing to test is to leave the PDF out of the picture - check if the variables are received when performing a HTTP POST from another web page to your script. If this works, the next step would be to have your script do a phpinfo(); or print_r($_POST); and submit from your PDF. This in order to determine what really is sent from the client.
    Now you should be able to pinpoint your problem.

  • How to test php offline?

    I am new to web stuff, and am running 10.5.4. I am trying to find if it is possible to test php offline, because where I volunteer in the day has no wi-fi, but I try to work on some php im learning.
    I have php installed, obviously, as well as apache. I have uncommented the lines in httpd.conf file, and I have enabled websharing in system prefs.
    I created a simple test.php file that calls phpinfo(), and it works I know because I ran it from terminal. But when I put the file into /library/websharing/documents and point localhost to it, all it does is display the code, not the info. Isn't it supposed to interpret the php that way? If not, is there anyway to do that?
    Thank you for help!

    nevermind, I searched httpd.conf and found the addtype line there, and already uncommented....
    Oh and also, if I type just http://localhost in the browser, it goes to an apache ready page saying if you see this the installation of apache was succesful...
    Message was edited by: x5452

  • Using PHP code to count downloads

    Hi,
    We are hosting our XML code here: http://krslynx.com/podcast/GTSPodcast.xml for our podcast A Good Talk Spoiled. We have no idea how many downloads we are getting so we had someone design a bit of PHP code (http://krslynx.com/podcast/pod.php) to count the downloads.
    In order to make this work, we change our enclosure url from http://krslynx.com/podcast/GTSWeek2.mp3 to http://krslynx.com/podcast/pod.php?podcast=GTSWeek2.mp3. Inserting pod.php?podcast= before the episode file name means that the data for the downloader is captured but the user of the podcast APP gets the error message "Episode Unavailable - This episode is temporary unavailable from "A Good Talk Spoiled Golf Podcast".
    I tried to insert this technology for our latest episode but it didn't work so I am now testing this technology on Week 2's episode.
    Does the podcast app / iTunes not support PHP technology?
    Thanks in advance for your help,
    Bobby.

    I can't test the Podcasts app, but when subscribing in iTunes the Week 2 episodes does not show, which means that iTunes is not seeing the episodes as containing playable media.
    This Apple help page:
    http://www.apple.com/itunes/podcasts/specs.html#tracking
    says
    The URL before the GET-style form values (before the first ?) must end in a media file extension (e.g., .mp3). To work around this, the feed provider can alter the URL from this:
    http://www.podcaster.com/load.php?f=&Wipeout.php
    to this:
    http://www.podcaster.com/load.mp3?f=&Wipeout.mp3
    Notice how it says load.mp3 instead of load.php. It should be possible to accomplish this via various means, such as web server rewrites. iTunes looks at the extension of the path part of the URL, i.e., the part before the "?".
    which explains what the problem is.

  • Php code about sql query

    for example:
    create table testtable (
    order_number number(4),
    item_id number(4),
    quantity number(8),
    item_desc varchar2(16)
    insert into testtable values (1001,1,10,'apple');
    insert into testtable values (1001,2,20,'banana');
    insert into testtable values (1002,2,50,'banana');
    insert into testtable values (1002,1,30,'apple');
    insert into testtable values (1003,3,60,'orange');
    insert into testtable values (1004,3,50,'orange');
    commit;
    Table Test DATA
    order_number item_id quantity item_desc
    1001 1 10 apple
    1001 2 20 banana
    1002 2 50 banana
    1002 1 30 apple
    1003 3 60 orange
    1004 3 50 orange
    i want to make above sql query output in 3 pages.
    order_number item_id quantity item_desc
    1001 1 10 apple
    1001 2 20 banana
    when i click next_page it output below:
    order_number item_id quantity item_desc
    1002 2 50 banana
    1002 1 30 apple
    and when i click next_page again it will output below:
    order_number item_id quantity item_desc
    1003 3 60 orange
    1004 3 50 orange
    using url:http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
    please look at three php code below:
    php code:
    <?php
    $con = oci_connect('apps','apps','prod');
    $sql = "select distinct h.order_number,h.order_type_id,h.price_list_id
    from oe_order_headers_all h
    where to_char(h.ordered_date,'YYYYMMDD') = '20060627'
    and h.org_id = 82
    order by order_number ASC";
    $result = oci_parse($con,$sql);
    oci_execute($result);
    echo "<table border = 1>";
    echo "<tr><td>order_number</td>";
    echo "<td>order_type</td>";
    echo "<td>price_id</td></tr>";
    while ($rows = oci_fetch_array($result,BOTH_NUM)) {
    echo "<tr><td>". $rows[0]."</td>";
    echo "<td>".$rows[1]."</td>";
    echo "<td>".$rows[2]."</td></tr>";
    ?>
    pager_functions.php
    <?php
    function total_pages($total_rows, $rows_per_page) {
    if ( $total_rows < 1 ) $total_rows = 1;
    return ceil($total_rows/$rows_per_page);
    function page_to_row($current_page, $rows_per_page) {
    $start_row = ($current_page-1) * $rows_per_page + 1;
    return $start_row;
    function count_rows(& $conn, $select) {
    $sql = "SELECT COUNT(*) AS num_rows FROM($select)";
    $stmt = oci_parse($conn,$sql);
    oci_define_by_name($stmt,"NUM_ROWS",$num_rows);
    oci_execute($stmt);
    oci_fetch($stmt);
    return $num_rows;
    function & paged_result(& $conn, $select, $start_row, $rows_per_page) {
    $sql = "SELECT
    FROM
    SELECT
    r.*, ROWNUM as row_number
    FROM
    ( $select ) r
    WHERE
    ROWNUM <= :end_row
    WHERE :start_row <= row_number";
    $stmt = oci_parse($conn,$sql);
    oci_bind_by_name($stmt, ':start_row', $start_row);
    // Calculate the number of the last row in the page
    $end_row = $start_row + $rows_per_page - 1;
    oci_bind_by_name($stmt, ':end_row', $end_row);
    oci_execute($stmt);
    // Prefetch the number of rows per page
    oci_set_prefetch($stmt, $rows_per_page);
    return $stmt;
    ?>
    outpages.php:
    <?php
    $conn = OCILogon('scott', 'tiger') or die ("Unable to connect to db");
    require_once 'pager_functions.php';
    $rows_per_page = 3;
    $url = 'results.php'; // URL to this script
    $sql = 'SELECT * FROM testtable ORDER BY rank ASC'; // The unfiltered
    // Get the total page count from the number of rows
    $total_rows = count_rows($conn,$sql);
    $total_pages = total_pages($total_rows, $rows_per_page);
    // Make sure the page number is a sane value
    if ( !isset($_GET['page']) ||
    !preg_match('/^[0-9]+$/',$_GET['page']) ||
    $_GET['page'] < 1 ) {
    $_GET['page'] = 1;
    } else if ( $_GET['page'] > $total_pages ) {
    $_GET['page'] = $total_pages;
    // Translate the page number into a starting row number
    $start_row = page_to_row($_GET['page'], $rows_per_page);
    // Filter to a single page of rows
    $stmt = & paged_result($conn, $sql, $start_row, $rows_per_page);
    ?>
    <table width="600">
    <caption>Feedster Top 500 Blogs [#<?php echo $_GET['page']; ?>]</caption>
    <thead>
    <tr>
    <th>Rank</th>
    <th>Blog</th>
    <th>Inbound Links</th>
    </tr>
    </thead>
    <tbody>
    <?php while (OCIFetchinto($stmt,$row,OCI_ASSOC)) { ?>
    <tr valign="top">
    <td align="right"><?php echo htmlspecialchars($row['RANK']); ?></td>
    <td>
    ">
    <?php echo htmlspecialchars($row['NAME']); ?>
    </a>
    </td>
    <td align="right"><?php echo htmlspecialchars($row['LINKS']); ?></td>
    </tr>
    <?php } ?>
    </tbody>
    <tfoot>
    <tr>
    <td colspan="3" align="center">
    <?php echo draw_pager($url, $total_pages, $_GET['page']); ?>
    </td>
    </tr>
    </tfoot>
    </table>
    ?>
    above two php codes in the same folder
    when i run outpages.php it runs below result:
    Feedster Top 500 Blogs [#1]
    Rank Blog InboundLinks
    may be above php code doesn't output what i mean .
    who can help me ?

    Hi,
    Your table testtable is defined as follows:
    create table testtable (
    order_number number(4),
    item_id number(4),
    quantity number(8),
    item_desc varchar2(16)
    In your script, you are refering to the columns 'RANK', 'NAME', 'URL' and 'LINKS'!!!
    They simly doesn't exist.
    You simply copied and pasted a snippet from the oracle-php-cookbook without adapting it to your needs. (And I assume without understanding, what that code will do.)
    Greetings from Hamburg
    Thorsten Körner

  • PHP Code Not Rendering

    Hi, I'm running Mac OS X 10.6.6 (Snow Leopard).
    I have tried for a couple hours now to install (or activate?) PHP on my Macbook Pro.
    I've done the following: Installed mySQL and got the server running, uncommented the LoadModule line in httpd.conf, restarted/started apachectl a bajillion times, made sure websharing is on, and even tried downloading the entropy php package and installing it.
    I've done all of these steps. This is what happens:
    WHen i go to http://localhost/phpinfo.php on safari, it renders the php info like it should.
    However, when I make a file like test.php with just the code <?php phpinfo(); ?> in it, it only displays the code and no information. Likewise, if i make any file ending in .php and open it in safari, there is only raw code shown and no rendering.
    Could someone please tell me what I'm doing wrong?
    Thanks so much in advance!

    On 13 Feb 2007 in macromedia.dreamweaver, crash wrote:
    >> That can't happen, unless there's some really broken
    browser
    >> sniffing going on on the server.
    >
    > Agreed.
    >
    >> I get some XHTML source code, because the content is
    delivered as
    >> text/plain. Is that what I'm supposed to see?
    >
    > That's what I'm seeing - take a look at the same file
    through IE.
    > Then, try to view this file through IE.
    >
    http://cooksfab.com/jobs.php
    - in IE, it tried to make me download
    > the file. I don't think PHP is correctly installed,
    perhaps?
    It may not be installed at all. Did you try the phpinfo()
    method? Put
    this in a plain text file named, say, phpinfo.php:
    <?php
    phpinfo();
    ?>
    If all you get back is that same code, check with your
    hosting provider
    whether PHP is available at all. (Or yell that it should
    be...)
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/email.php

  • PHP Code & PDF Forms

    Hello-
    First if this has been answered already I'm sorry as I have not yet located this answer to these questions (or they are half answered)
    1)  Can I build a PDF form that on submit it will upload to a server (the entire pdf file) using PHP code?  If so please tell me the best way to accomplish this as I want any user to fill out the pdf and then submit to a specific location of a folder on my site.
    2) I know that Adobe Reader v. 6 will not allow people to submit electronically - but am I correct that version 7 to the lastest will allow them to submit the form (via email or FTP if possible)?  I keep finding yes/no. I am aware of Adobe Reader Usage Rights that has to be assigned.
    Thanks in Advance
    -Brit

    The answer to question 1 is yes, assuming the form is Reader Extended by a LiveCycle Reader Extensions Server (the Extended Usage Rights in Acrobat are not sufficient).
    The answer to 2 is yes and no.  By e-mail, as long as the user has a client configured through MAPI (such as Outlook on Windows) you can automate the attaching to an e-mail (but not sending - the user still needs to click send).  If the user uses a web client like GMail, then no, that can't be automated.  And Acrobat does not have built-in FTP functionality.

  • Firefox 3 displays the php code when pages launched from dreamweaver 8

    The problem seems to relate to files opening as —
    file:///C:/localweb/ .... when sent from Dreamweaver 8.0 to Firefox
    The first html/php page loads correctly from dreamweaver as
    processed HTML, a second page linked from either an HTML or php
    page also loads correctly, but selecting any link from that or
    subsequent pages displays the full php code instead of processed
    html layout - so this appears to be a third level or greater
    problem.
    If I manually substitute -
    http://localhost/ — the problem
    does not arise.
    This is a problem with version 3 of firefox, all previous
    versions I used worked fine with both — file:///C:/localweb/
    and
    http://localhost/
    Both prefixes also appear with pure HTML sites, but they load
    and function correctly.
    Not every php site I have loads with file:///C:/localweb/, so
    I am wondering if this relates to something in the php code or
    Dreamweaver - I have conn.php set to:
    mysql_connect("localhost", "root", "") or die(mysql_error());
    I use winxp and have xampp installed - everything worked fine
    until I installed Firefox 3

    > but selecting any link from that or subsequent pages
    You are being confused by a) not understanding root relative
    vs document
    relative links, and b) not understanding how DW previews
    files.
    If I have a document with a link to an image that looks like
    this -
    <img src="/images/foo.gif"...
    That's what's called a root relative link.
    If I preview that document in DW, then the browser gets the
    document, sees
    the leading "/" and reads that as the root of the hard drive,
    since the
    browser has no idea where the root of the site is. Thus, the
    image is
    broken in the preview.
    If I have temp files enabled, then DW will secretly convert
    the file being
    previewed into a temporary file, and hand that to the
    browser. This temp
    file has had all root relative links converted to document
    relative links
    (as you will see by looking at the code in the browser), and
    has had all
    include files actually embedded in the page, and has had all
    external CSS
    and js markup embedded in the page. In other words, DW has
    made the
    document into a stand-alone page.
    If you do not have temp files enabled, all of these links
    would be broken on
    preview.
    Now - if you are using root relative links, AND you have temp
    files enabled,
    AND you click away from the previewed document, then all of
    your links will
    be broken, since DW has not made that linked file into a temp
    file. This is
    what you are seeing.
    So - if you want to click away on preview, then you must use
    document
    relative links for the site -
    <img src="../images/foo.gif"... (for example)
    These will still work on preview since the browser knows how
    to determine
    the current file's location and how to follow that path.
    Make sense?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "gbiras" <[email protected]> wrote in
    message
    news:[email protected]...
    > The problem seems to relate to files opening as ?
    file:///C:/localweb/
    > ....
    > when sent from Dreamweaver 8.0 to Firefox
    >
    > The first html/php page loads correctly from dreamweaver
    as processed
    > HTML, a
    > second page linked from either an HTML or php page also
    loads correctly,
    > but
    > selecting any link from that or subsequent pages
    displays the full php
    > code
    > instead of processed html layout - so this appears to be
    a third level or
    > greater problem.
    >
    > If I manually substitute -
    http://localhost/ ? the problem does
    not arise.
    >
    > This is a problem with version 3 of firefox, all
    previous versions I used
    > worked fine with both ? file:///C:/localweb/ and
    http://localhost/
    >
    > Both prefixes also appear with pure HTML sites, but they
    load and function
    > correctly.
    >
    > Not every php site I have loads with
    file:///C:/localweb/, so I am
    > wondering
    > if this relates to something in the php code or
    Dreamweaver - I have
    > conn.php
    > set to:
    >
    > mysql_connect("localhost", "root", "") or
    die(mysql_error());
    >
    > I use winxp and have xampp installed - everything worked
    fine until I
    > installed Firefox 3
    >

  • Can anyone tell me what apple hardware test error code apple hardware 4MOT/4/40000002: Exhaust-1153 or 1209 means? I am running a MacBook Pro.

    Can anyone tell me what apple hardware test error code apple hardware 4MOT/4/40000002: Exhaust-1153 or 1209 means? I am running a MacBook Pro

    The motor on the exhaust fan has failed or is failing.

  • A difficult problem with php code and sql code

    it's good place to visit(Paged Result Sets with PHP and Oracle)
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
    maybe below part php code could not be used in above address's php code.
    if((isset($l_company) and $l_company != $rows['COMPANY']) or empty($stmt) and empty($total_pages) ) {
    echo "<tr bgcolor='#CCFFCC'>";
    echo "<td colspan= 3 align='center'>".$l_company."</td>";
    echo "<td >".$totalcomany." </td>";
    $totalcomany = 0;
    echo "<td > </td>";
    echo "</tr>";
    $l_company = $rows['COMPANY'];
    because the same company in one page could calculate sum while if
    the same company in two pages could not do that.
    and what do you think of ?
    thanks !

    Hi,
    this is because your sql-statement selects only the rows, you need to build this one page.
    Neither php nor the given result from your query knows about data wich will be part of the result of another page.
    Greetings from Hamburg
    Thorsten Körner

  • What are the meanings of Apple Hardware Test error codes 4m0t/4/40000003:hdd-1300 and 4m0t/4/40000003:hdd-1308?

    what are the meanings of Apple Hardware Test error codes 4m0t/4/40000003:hdd-1300 and 4m0t/4/40000003:hdd-1308?

    Thanks - Even though I'm years out of warranty I got chat help from Apple (I said they should help me since the codes aren't published.)  We covered three different questions, and although I didn't get a specific decoding of the error code, I got confirmation of what other comments here imply - it might have helped that I indicated I'd already been here - and useful links to how to do back ups, including to CD(s). (I don't have a lot of data on this computer yet)
    Now I need to figure out how to decide how hot-to-the-touch is "too hot" for the metal frame at the top of the iMac to decide whether I'm getting adequate fan performance or insufficient.  While chatting I initially reported it was cool at the bottom and warm at the top.  Apple hadn't asked, but their response prompted me to feel it again, and I'd say the top was hot, not warm - I updated but Apple didn't comment further except to conclude after addressing the other questions that I should take it in for further assessment - don't really want to bother with that.

  • I need php code for copy paste our all histroy of browser in a text page.

    I need php code for copy paste our all histroy of browser in a text page can any one send me the code please.

    You can use an application like GarageSale for doing this....
    http://www.macupdate.com/info.php/id/16035/garagesale

  • Having trouble with my PHP code. Appers to get stuck on a white page.

    HI all,
    I have just began having trouble with my PHP code. Was working before and haven't made any changes to the code since last time it worked.
    What happens is after the form is submitted it goes to a white page (no text just all white page) and in the address bar it has the path for my php page. what supposed to happen is either it goes to a success page or a error page.
    I've had a problem where the info entered is correct but was directed to the error page. i managed to fix that issue but i am puzzled what is happening to my php page now.
    Mind you that i didn't write this code i just took over the responsiblities of this website and i am hopping that its a quick fix.
    I appreciate any help you could give me. Thank you.
    CODE:
    <?php
       $to = '[email protected]';
          $from = '[email protected]';
            //Make sure we have some info posted from the form...
            if (isset($HTTP_POST_VARS)){
                //Clear the body of the message to be sent
                $body = '';
                //go through all POSTed variables sent
                while (list($key, $value) = each($HTTP_POST_VARS)){
        if($key <> "Submit" && $key <> "submit") {
         $body .= $key . ' = ' . $value . "\r\n"; 
                //Now building mail headers.....
                $headers = "From: ".$from."\r\n";
                //Mail message
                $success = mail($to, "Email Club" . date("m/d/Y"), $body, $headers);
       // CURL stuff.....
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_FAILONERROR, 1);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
       curl_setopt($ch, CURLOPT_TIMEOUT, 4); //times out after 4s
       curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
                 if ($success){
        //readfile('http://www.lvpaiutegolf.com/thankyou.html');
        curl_setopt($ch, CURLOPT_URL,"http://www.lvpaiutegolf.com/thankyou.html");
        header("Location:http://www.lvpaiutegolf.com/thankyou.html");
                else{
                 // readfile('http://www.lvpaiutegolf.com/error.html');
         curl_setopt($ch, CURLOPT_URL,"http://www.lvpaiutegolf.com/error.html");
         header("Location:http://www.lvpaiutegolf.com/error.html");
       // Output
       //$result=curl_exec ($ch);
       //curl_close ($ch);
       //echo $result'";
    ?>

    Insert the install disk and boot from it. Use disk utitlity to repair your drive and check for errors (report any errors back here) then reinstall the os. This should not erase your data.

Maybe you are looking for