Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: php script

  1. #1
    Join Date
    Mar 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php script

    Hi Guy's,
    I am Gavin, I am creating a simple form. I want a php script that will work from my computer. In other words I dont want to have a website uploaded.
    For example - The form contains a drop down list, some check boxes, some textareas where one can type custom note and some radio buttons.
    Now when the form is submitted it should give another page with the information typed in into a text area - all formatted as if it was typed in a perfect order

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    php DOESN'T work without a server. it is a server side script.

    you can either use it from a server, or set up your home computer as a server (search for WAMP/LAMP/MAMP-- W/L/M-- windows/mac/linux respectively).

    You could also, I suppose, setup some sort of executable that would do this, but compiling php doesn't, to my knowledge, allow interaction like a server, so it wouldn't be able to act as the destination for the form.

    If you really can't have a server setup, you could try to use javascript (but it would be more complex), or you could use some general purpose programming language to make a real program.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I have an example of the form and its output

    here is the form
    Code:
    <HTML><HEAD><TITLE>DSLAM RESET</TITLE>
    <link href="../../../default.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .style3 {color: #000000}
    .style5 {font-size: 10pt; color: black; background-color: #EFEFEF;
    font-family: Arial, Verdana, Helvetica, sans-serif;}
    -->
    </style>
    </HEAD>
    <SCRIPT>
    var dSlam = false;
    var mOdem = false;
    var dId = false;
    <!-- this script is for checking for required fields --theDVZ -->
    function verify() {
    var themessage = "Please complete the following fields: ";
    
    
    if (document.getElementById("Username").value=="") {
    themessage = themessage + " - Username";
    }
    
    
    var isChecked = false;
    for(i = 0; i < document.dslamFRM.HastheDSLAMbeenResetbefore.length;i++)
    {
    if(document.dslamFRM.HastheDSLAMbeenResetbefore[i].checked == true)
    isChecked = true;
    }
    if(isChecked == false)
    themessage = themessage + " - Has the DSLAM been Reset before";
    
    if (document.getElementById("PreviousResetPRs").value == "" && dSlam)
    {
    themessage = themessage + " - List previous Reset PRs";
    }
    
    var isChecked = false;
    for(i = 0; i < document.dslamFRM.Numberofphonesockets.length;i++)
    {
    if(document.dslamFRM.Numberofphonesockets[i].checked == true)
    isChecked = true;
    }
    if(isChecked == false)
    themessage = themessage + " - Number of phone sockets";
    
    if (document.getElementById("CPEcurrentlyconnected").value=="") {
    themessage = themessage + " - CPE currently connected";
    }
    
    var isChecked = false;
    for(i = 0; i < document.dslamFRM.Samemodemusedaslastreset.length;i++)
    {
    if(document.dslamFRM.Samemodemusedaslastreset[i].checked == true)
    isChecked = true;
    }
    if(isChecked == false)
    themessage = themessage + " - Is it the same modem used as last
    reset";
    
    if (document.getElementById("DIFmodem").value == "" && mOdem) {
    themessage = themessage + " - Type / Model of different Modem";
    }
    
    var isChecked = false;
    for(i = 0; i <
    document.dslamFRM.Modemsamesocketsincelastreset.length;i++)
    {
    if(document.dslamFRM.Modemsamesocketsincelastreset[i].checked == true)
    isChecked = true;
    }
    if(isChecked == false)
    themessage = themessage + " - Is the Modem in the same phone socket
    since last reset";
    
    var isChecked = false;
    for(i = 0; i < document.dslamFRM.didit.length;i++)
    {
    if(document.dslamFRM.didit[i].checked == true)
    isChecked = true;
    }
    if(isChecked == false)
    themessage = themessage + " - Did the DSLAM reset resolve the issue";
    
    if (document.getElementById("actioN").value == "Troubleshoot as per
    Procedure" && dId) {
    themessage = "NO IFMS REQUIRED AS NOT RESOLVED - Troubleshoot as per
    Fault Type";
    }
    
    //alert if fields are empty and cancel form submit
    if (themessage == "Please complete the following fields: ") {
    return true;
    }
    else {
    alert(themessage);
    return false;
    }
    }
    </SCRIPT>
    <BODY>
    <table width="600" border="0" align="center" cellpadding="5">
    <tr>
    <td class="emphasis2"><strong>I need a script that will convert the information
    filled in the following fields to appear like in the next file</strong></td>
    </tr>
    <tr>
    <td class="emphasislite"><strong> This is an actual working form - the only
    issue is this one is using a php on the server end - what I want is a javascript
    which does not need a backend that will proces the form as you see in the
    next page [code pasted]</strong></td>
    </tr>
    </table>
    
    <form name=dslamFRM enctype='multipart/form-data' action='process.php'
    method='post' onSubmit="javascript: return verify(); ">
    <table width='600' border=0 align="center" cellpadding="5">
    <tr class="table">
    <td width='323'><strong> Name : </strong></td>
    <td width='251'>
    <input type=text name='Username' id='Username'></td></tr>
    <tr class="table">
    <td width='323'><strong> Has the clock been Reset before : </strong></td>
    <td width='251'>
    <input name="HastheDSLAMbeenResetbefore" type="radio" value="YES"
    onClick="document.getElementById('hide1').style.display = 'inline'; dSlam
    = true;"><b>Yes
    <input name="HastheDSLAMbeenResetbefore" type="radio" value="NO"
    onClick="document.getElementById('hide1').style.display = 'none'; dSlam =
    false;">No</b></td>
    </tr>
    <tr class="table" id="hide1" style="display:none">
    <td width='323'><strong>If <span class="redbold">YES</span> above,
    List previous Reset PRs :<br>
    </strong></td>
    <td width='251'>
    <textarea name='PreviousResetPRs' rows=5 cols=10></textarea></td></tr>
    
    <tr class="table">
    <td width='323'><strong> Number of watches : </strong></td>
    <td width='251'>
    <input name="Numberofphonesockets" type="radio" value="1"><b>1
    <input name="Numberofphonesockets" type="radio" value="2">2
    <input name="Numberofphonesockets" type="radio" value="3">3
    <input name="Numberofphonesockets" type="radio" value="4">4
    <input name="Numberofphonesockets" type="radio" value="5 or More">5
    or More</b></td>
    </tr>
    <tr class="table">
    <td width='323'><strong> Please explain the nature of the defect</strong></td>
    <td width='251'>
    <textarea name='CPEcurrentlyconnected' id='CPEcurrentlyconnected'
    rows=10 cols=35></textarea></td></tr>
    <tr class="table">
    <td width='323'><strong> Is it the same watch used : </strong></td>
    <td width='251'>
    <input name="Samemodemusedaslastreset" type="radio" value="YES"
    onClick="document.getElementById('hide2').style.display = 'none'; mOdem =
    false;"><b>Yes
    <input name="Samemodemusedaslastreset" type="radio" value="NO"
    onClick="document.getElementById('hide2').style.display = 'inline'; mOdem =
    true;">No</b></td>
    </tr>
    
    <tr class="table" id="hide2" style="display:none">
    <td><strong>Type / Model of the watch</strong></td>
    <td><input name='DIFmodem' type=text id='DIFmodem'
    size="20"></td>
    </tr>
    
    
    
    <tr class="table">
    <td width='323'><strong> Is the watch in the same box : </strong></td>
    <td width='251'><input name="Modemsamesocketsincelastreset"
    type="radio" value="YES"><b>Yes
    <input name="Modemsamesocketsincelastreset" type="radio"
    value="NO">No</b></td>
    </tr>
    <tr class="table">
    <td width='323'><strong> Did the change satisfy the customer: </strong></td>
    <td width='251'>
    <input name="didit" type="radio" value="YES"
    onClick="document.getElementById('hide3').style.display = 'none'; dId = false;"><b>Yes
    <input name="didit" type="radio" value="NO"
    onClick="document.getElementById('hide3').style.display = 'inline'; dId = true;">No</b></td>
    </tr>
    
    
    <tr class="table" id="hide3" style="display:none">
    <td><strong class="redbold"> If NO ACTION TO TAKE ==&gt;
    </strong></td>
    <td>
    <input name='actioN' type=text id='actioN' readonly
    value="Troubleshoot " size="32">
    </td>
    </tr>
    
    
    </table>
    <div align="center">
    <input type='submit' value='Generate Template'>
    <input type=reset value='Clear Form'>
    </div>
    </form>
    </BODY></HTML>
    Last edited by tech_support; 10-18-2007 at 07:25 AM.

  4. #4
    Join Date
    Mar 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This is the output

    Code:
    <script language="JavaScript">
    // Copy and Clear Function
    function ClipBoard(){
    Copied = dump.createTextRange();
    Copied.execCommand("RemoveFormat");
    dump.select();
    Copied.execCommand("Copy");
    }
    </script>
    
    
    <link href="../../../default.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .style1 {font-family: "Comic Sans MS"}
    -->
    </style>
    
    
    <h2 class="emphasis">COMPLETED </h2>
    <br />
    <table width="600" border="1" align="center" class="table">
    <tr>
    <td>
    <div align="center" class="table"> <br />
    <textarea cols="60" rows="10" name="dump">
    Name : fff
    Has the clock been Reset before : B4: NO
    Number of watches : 3
    Please explain the nature of the defect ffff
    Is it the same watch used : YES
    clock in same socket since last reset: YES
    Is the watch in the same box :YES</textarea>
    <br>
    <input type="button" value="Copy Above for IFMS COMMENTS"
    name="capture" onclick="ClipBoard()">
    <br><br>
    
    <input type="button" value="Return to Template" name="back"
    onclick="window.location='form1.html'">
    
    <br />
    <br />
    <br />
    </div></td>
    </tr>
    </table>
    Last edited by tech_support; 10-18-2007 at 07:25 AM.

  5. #5
    Join Date
    Mar 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I would like to make this form work without any server side script - javascript will do - This form is basically to make notes or document the conversation faster at work without having to type

    I greatly appriciate Blizz's contribution in helping me - I would also like an alternative method using javascript for computer that may not have flash on them


    Thanks

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Well, you can't. You need PHP or some other server side language (Ruby, Python etc.) to do this.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Javascript will result in nothing--- just, at best, some parsed version of the input, which a TON of javascript code to get there. It cannot be stored; it cannot be used; it cannot actually DO anything.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Mar 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Daniel,
    You have by now seen the form - Can you help me with a simple button that will copy the content of the form to the clipboard? I really need this urgently. If you could help

    Thanks

    Regards
    Gavin

  9. #9
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by gavinv3 View Post

    I greatly appriciate Blizz's contribution in helping me - I would also like an alternative method using javascript for computer that may not have flash on them


    Thanks
    If the other computers in question have a web browser and that browser has the Flash Player installed, they don't need to be connectedto the internet, but can open the final .swf (or locally stored Flash outputted HTML) in their browser and do it that way

    Alternately you can build something in Java, but the computers would need java installed to run it....
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. #10
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Quote Originally Posted by gavinv3 View Post
    Hi Daniel,
    You have by now seen the form - Can you help me with a simple button that will copy the content of the form to the clipboard? I really need this urgently. If you could help

    Thanks

    Regards
    Gavin
    Look, there IS no way. None. Nothing. No. Way. You. Can. Do. This.

    (Unless you use IE or Flash, which you can use: http://ajaxian.com/archives/auto-copy-to-clipboard)
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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
  •