Log in

View Full Version : php script



gavinv3
10-17-2007, 04:25 AM
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

djr33
10-17-2007, 05:56 AM
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.

gavinv3
10-18-2007, 01:18 AM
here is the form


<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>

gavinv3
10-18-2007, 01:19 AM
<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>

gavinv3
10-18-2007, 01:23 AM
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

tech_support
10-18-2007, 07:28 AM
Well, you can't. You need PHP or some other server side language (Ruby, Python etc.) to do this.

djr33
10-18-2007, 07:43 AM
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.

gavinv3
10-20-2007, 05:49 PM
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

BLiZZaRD
10-20-2007, 06:11 PM
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....

tech_support
10-21-2007, 05:36 AM
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)

Pardeep
10-26-2007, 12:41 AM
Hi,

This is very easy to get posted form values at next page and echo it.
I will email this code if u provide email

djr33
10-26-2007, 04:44 AM
Which language would you use? Remember his server doesn't allow PHP, etc.

Also, please just post the code here on the board. Emailing it will not allow anyone else to help debug or explain it if there are problems and it will not allow others to learn from it or search for a similar answer later.