The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
Reply to this topicStart new topic
> Need help with code for my cost generator., Can't get code to input value and next page
SeanWoods
post Mar 23 2009, 12:14 PM
Post #1


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



I am creating a website where I proofread people's documents and charge per word.

Basically, I want the number from my word count calcultor http://www.grammarperfection.com/cost.html to pop into the my checkout page http://www.grammarperfection.com/checkout....rv=1&words=

The number shows up in the url, but not on my checkout page in the box labeled "number of words."

The code I am using so far for this calculator and checkout page are from another website.

The code came from http://www.proofmydoc.com/proofmydoc.php. So far the only things I have changed are to replace my own urls in the code to make the pages change to my own when clicking "proceed with order." Once I get the basic code working properly, I will change the look and feel of the page to match my own page.

Here is my website with the code inputted http://www.grammarperfection.com/checkout.php

I am told I need server side code. I am not really sure what this is, or what code I even need.

Please help!

Here is the code for my checkout page that I am having trouble with:
<!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"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="Images/gpfavicon.ico"/>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Editing, Proofreading and Grammar Checking Service - Grammar Perfection</title>
<!-- InstanceEndEditable -->
<meta name="keywords" content="service,editing,english grammar,proofreading,apa style,writing help,editorial services,essay editing,grammar help,proofread,academic paper,proofreading english,proofreading online,business editorial,proofreading service,proofreading services,business editor,write,college application,apa style,college applications,resume,editorial,resumes,edit document,writing,cover letter,cover letters,editing service,resumes cover letters,writing,apa style,apa,online editor,cbe style,cbe,proofreading essay,english,mla style,mla,editing services,chicago style, financial document,grammer help,financial documents,english writing,academic papers,copy editor,business proofreading,mla style,edit,editor,english grammer,essay help,">
<meta name="description" content="Professional proofreading and editing service. We edit essays, resumes, and other forms of writing. Let our editing specialists proofread your writing today.">
<!--GrammarPerfection.com: writing editing apa style proofreading writing editors english grammar proofreading apa style editing writing apa style editors english grammar mla style writing editing apa style editing mla style proofreading writing english grammar mla style etc.-->
<style type="text/css">
<!--
-->
</style>
<link href="CSS/layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-image: url(Images/background.gif);
}
.style1 {
font-size: 1px;
color: #CCCCCC;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<div id="logo"><a href="index.html"><img src="Images/grammar-perfection-proofreading-and-editing-service.jpg" alt="Logo" width="620" height="172" /></a></div>
<div id="navigation"><a href="index.html">Home</a> | <a href="submitdocument.html">Submit Document</a> | <a href="guarantee.html">100% Guarantee</a> | <a href="examplesofwork.html">Example of Our Work</a> | <a href="faq.html">FAQ</a> | <a href="recommendafriend.html">Get 1/2 Off Your Next Order</a> | <a href="cost.html">Cost</a></div>
<div id="wrapper">
<div id="bodyArea">
<div id="left">
<h5><a href="index.html"><img src="Images/grammer-perfection-home-icon.jpg" alt="Home for proofreading and editing "class="img" longdesc="../index.html" /><br />
Home</a></h5>
<h5><a href="submitdocument.html"><img src="Images/submit-your-document-for-proofreading-editing-icon.jpg" alt="Submit your document for editing and proofreading" name="icons" id="icons" /><br />
Submit Document</a></h5>
<h5><a href="guarantee.html"><img src="Images/satisfaction-guaranteed-icon.jpg" alt="Satisfaction guaranteed on our proofreading service or your money back" name="icons" id="icons" /><br />
100% Guarantee!</a></h5>
<h5><a href="examplesofwork.html"><img src="Images/example-of-what-grammar-perfection-does.jpg" alt="Example of Our Work Link" name="icons" id="icons" /><br />
Example of Our Work</a></h5>
<h5><a href="faq.html"><img src="Images/frequently-asked-questions-about-proofreading-editing.jpg" alt="Frequently Asked Questions" name="icons" id="icons" /><br />
Frequently Asked Questions</a></h5>
<h5><a href="recommendafriend.html"><img src="Images/proofreding-editing-discount.jpg" alt="Recommend a Friend Link" name="icons" id="icons" /><br />
Get 1/2 Off Your Next Order!</a></h5>
<h5><a href="cost.html"><img src="Images/cost-for-proofreading-editing-service.jpg" alt="Cost Link" name="icons" id="icons" /><br />
How Much Does it Cost?</a></h5>
</div>
<div id="right"> <!-- InstanceBeginEditable name="Main Area" -->
<h1><span class="pagetitle">Checkout </span></h1>
<table width="620" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td class="pagetitle" align="left" nowrap="nowrap" height="20"><div align="center"></div></td>
</tr>
<tr>
<td class="pagetext" valign="top" width="625"><form name="grammarperfection" action="/confirmorder.php" method="post">


<div align="center">
<table width="604" border="1" cellpadding="4" cellspacing="0">
<tr>
<td class="pagetext" width="260"><b>Service Option</b> </td>
<td width="322"><select size="1" name="optService">
<option value="1" selected="selected">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
<option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
<option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select> </td>
</tr>
<tr>
<td class="pagetext" width="260"><b>Number of Words</b> (300 Words=1 Page) </td>
<td class="pagetext"><input type="text" name="txtWordCount" size="20" maxlength="20"
value=" ">
<a href="/cost.html">Word Counter/Cost Estimator</a> </td>
</tr>
<tr>
<td class="pagetext"><b>Level of Work</b> </td>
<td><select size="1" name="optLevel">
<option value="High School">High School</option>
<option value="Admission">College - Admission</option>
<option value="College - Under Graduate">College - Under Graduate</option>
<option value="College - Post Graduate">College - Post Graduate</option>
<option value="Website">Website</option>
<option value="Business">Business</option>
<option value="Other">Other</option>
</select> </td>
</tr>
<tr>
<td class="pagetext"><b>Writing Format</b> </td>
<td><select size="1" name="optFormat">
<option value="MLA">MLA</option>
<option value="AP">AP</option>
<option value="N/A">N/A</option>
</select> </td>
</tr>
<tr>
<td class="pagetext" colspan="2"><input type="submit" value="Proceed With Order" name="btnOrder" /> </td>
</tr>
</table>
</div>
</form></td>
</tr>
</table>
<p> </p>
<p> </p>
<!-- InstanceEndEditable --></div>
<div id="footer">
<p><a href="customerservice.html">Customer Service</a> | <a href="links.html">Links</a> | <a href="employment.html">Employment</a></p>
</div>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-3295634-3");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
<!-- InstanceEnd --></html>

This post has been edited by SeanWoods: Mar 23 2009, 12:17 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 23 2009, 02:26 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



Moved this topic to the Server-side scripting forum, and removed a very similar post.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 23 2009, 02:36 PM
Post #3


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(SeanWoods @ Mar 23 2009, 06:14 PM) *

I am told I need server side code. I am not really sure what this is, or what code I even need.

Server-side code is code (written in e.g. PHP and uploaded to your server/web host) that produces finished HTML, which is then sent to the visitors' browsers. In order to view the code you must download it from your web host account with FTP, with a browser you'll just see the finished HTML.


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 23 2009, 03:57 PM
Post #4


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(Christian J @ Mar 23 2009, 02:36 PM) *

QUOTE(SeanWoods @ Mar 23 2009, 06:14 PM) *

I am told I need server side code. I am not really sure what this is, or what code I even need.

Server-side code is code (written in e.g. PHP and uploaded to your server/web host) that produces finished HTML, which is then sent to the visitors' browsers. In order to view the code you must download it from your web host account with FTP, with a browser you'll just see the finished HTML.



Do you know if it is possible to download the server-side code for http://www.proofmydoc.com/proofmydoc.php ?

I have been building my checkout page based on code from this site and modifying it for my own use. This is the only part I have left to make it work.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Mar 23 2009, 04:20 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
Do you know if it is possible to download the server-side code for http://www.proofmydoc.com/proofmydoc.php ?
Do you have access to the proofmydoc.com server?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 23 2009, 04:41 PM
Post #6


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(Darin McGrew @ Mar 23 2009, 04:20 PM) *

QUOTE
Do you know if it is possible to download the server-side code for http://www.proofmydoc.com/proofmydoc.php ?
Do you have access to the proofmydoc.com server?


Unfortunately no. I take it I would have to have access in order to view the code?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Mar 23 2009, 04:49 PM
Post #7


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
Unfortunately no. I take it I would have to have access in order to view the code?
Yes.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
geoffmerritt
post Mar 24 2009, 08:30 AM
Post #8


Member
***

Group: Members
Posts: 66
Joined: 23-December 08
From: Adelaide
Member No.: 7,394



Sean

I am putting some basic script below, to maybe help you along the way.

To fix the problem of getting the data from the previous page and placing on the checkout page the code below will help.

www.php.net is THE source for help with PHP, you will need to find out if your server is php enabled.


CODE


<?php // lets the server know that php script is being uses, will need to call the file ****.php

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

if($serv == 1)
    {
    $serv = "Product 1"; // rename to match you product details
    }
else
   {
   if($serv == 2)
     {
     $serv = "Product 2";
     }
   } // this code checks what product details to show in the dropdown menu.

?> // tells the server the script is finished

<!-- this code is in the html -->
<option value="1" selected="selected"><? echo  '$serv'; ?></option>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo  '$words'; ?>">


This is a very basic.... and hopefully will give you assistance.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 24 2009, 11:47 AM
Post #9


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(geoffmerritt @ Mar 24 2009, 08:30 AM) *

Sean

I am putting some basic script below, to maybe help you along the way.

To fix the problem of getting the data from the previous page and placing on the checkout page the code below will help.

www.php.net is THE source for help with PHP, you will need to find out if your server is php enabled.


CODE


<?php // lets the server know that php script is being uses, will need to call the file ****.php

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

if($serv == 1)
    {
    $serv = "Product 1"; // rename to match you product details
    }
else
   {
   if($serv == 2)
     {
     $serv = "Product 2";
     }
   } // this code checks what product details to show in the dropdown menu.

?> // tells the server the script is finished

<!-- this code is in the html -->
<option value="1" selected="selected"><? echo  '$serv'; ?></option>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo  '$words'; ?>">


This is a very basic.... and hopefully will give you assistance.


Geoff,

Thanks for the help. It is very beneficial. I checked with my web host (1and1.com) and they allow PHP use. I noticed towards the bottom of the code you put: <!-- this code is in the html -->. Does that mean that everything below that is in the HTML? Do I put the entire code and the server will pull the top part?

Thanks again.

Sean
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Mar 24 2009, 12:30 PM
Post #10


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Basically you need to include all of the code within the file generating your page -- the bit marked "in the html" needs to be where, um where it is to appear. The "calculation" bit can be anywhere above that -- e.g. right at the beginning before you start outputting the html page.

There is an error in the above, btw:

<? echo '$serv'; ?>

echos the string $serv, which isn't what you want, which is:

<? echo $serv; ?>

or even shorter, but it means remembering an extra bit of syntax:

<?= $serv ?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
geoffmerritt
post Mar 24 2009, 04:15 PM
Post #11


Member
***

Group: Members
Posts: 66
Joined: 23-December 08
From: Adelaide
Member No.: 7,394



Sean

The part that goes in the html, I pulled those lines out of your page made some changes, and should go back in the same spot.

The PHP would procede the <html> tags.


and thanks Brian for pointing out the error... as it was late and I didn't test the code .... guess there was going to be errors

This post has been edited by geoffmerritt: Mar 24 2009, 04:20 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 24 2009, 08:52 PM
Post #12


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(geoffmerritt @ Mar 24 2009, 04:15 PM) *

Sean

The part that goes in the html, I pulled those lines out of your page made some changes, and should go back in the same spot.

The PHP would procede the <html> tags.


and thanks Brian for pointing out the error... as it was late and I didn't test the code .... guess there was going to be errors


I am so close to getting this page to work thanks to your code! I did get the word count to work, but am having trouble with my drop down box.

I think I am having trouble with what Brian mentioned when he said:
___________________________________________________________________
There is an error in the above, btw:
<? echo '$serv'; ?>
echos the string $serv, which isn't what you want, which is:

<? echo $serv; ?>
or even shorter, but it means remembering an extra bit of syntax:
<?= $serv ?>
___________________________________________________________________

The different options show up on the page, but they are not in a drop down box. I added a third option in the drop down box. Perhaps I did this wrong. Also they have the "word count" next to it as well when it populates.

URL http://www.grammarperfection.com/checkout....1&words=506

Here is the code I inputted:

<?php //

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}
else
{
if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}
} // this code checks what product details to show in the dropdown menu.

{
if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}
}
?>

<option value="1" selected="selected"><?=$serv ?></option>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">

<option value="2" selected="selected"><?=$serv ?></option>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">

<option value="3" selected="selected"><?=$serv ?></option>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
geoffmerritt
post Mar 25 2009, 02:58 AM
Post #13


Member
***

Group: Members
Posts: 66
Joined: 23-December 08
From: Adelaide
Member No.: 7,394



We can tidy up the code a bit...
CODE


<?php //

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>



you have 3 occurrences of the html code, you only need the one, replace <option value="1" selected="selected"><?=$serv ?></option> with the text below and keep <input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>"> as it is working.

CODE

<select name="select">
  <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
  <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
  <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
  <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>


As this code places values in a text box/drop down menu, it can still be edited by the user.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 25 2009, 06:44 AM
Post #14


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(geoffmerritt @ Mar 25 2009, 02:58 AM) *

We can tidy up the code a bit...
CODE


<?php //

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>



you have 3 occurrences of the html code, you only need the one, replace <option value="1" selected="selected"><?=$serv ?></option> with the text below and keep <input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>"> as it is working.

CODE

<select name="select">
  <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
  <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
  <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
  <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>


As this code places values in a text box/drop down menu, it can still be edited by the user.


OK, now I am REALLY close. I put in the code the Geoff recommended and in the browser I get the error message: Parse error: syntax error, unexpected T_IF in /homepages/30/d219691049/htdocs/checkout.php on line 84.

Line 84 is if($serv == 1)

I looked directly above this line and thought it might need a semi-colon. I put one directly after $servvalue = $serv which is one line above. I tried it again and the page did populate, but it has whatever option was previously selected on the previous page (Standard, Expedite, Overnight) is now listed twice in the drop down box and also has the word count listed right next to it, which should only be in the box below.

See url: http://www.grammarperfection.com/checkout....1&words=130

Here is the code exactly as I have it:

<?php //

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>

<select name="select">
<option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
<option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
<option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
<option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">

</select> </td>
</tr>
<tr>
<td class="pagetext" width="260"><b>Number of Words</b> (300 Words=1 Page) </td>
<td class="pagetext"><input type="text" name="txtWordCount" size="20" maxlength="20"
value="<? echo $words; ?>" />
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
geoffmerritt
post Mar 25 2009, 07:31 AM
Post #15


Member
***

Group: Members
Posts: 66
Joined: 23-December 08
From: Adelaide
Member No.: 7,394



Sean

Have tested, the only problem was the missing ;

Geoff

CODE
<?

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>
<html>
<body>
<select name="select">
  <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
  <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
  <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
  <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">
</body>
</html>

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
geoffmerritt
post Mar 25 2009, 07:49 AM
Post #16


Member
***

Group: Members
Posts: 66
Joined: 23-December 08
From: Adelaide
Member No.: 7,394



Sean, the only issue was the placement of the "input tag", the reason it was coming up twice, is because it was included twice :-)

I forget that sometimes I need to explain a bit more and that we are all at different stages of learning.

Have added some comments where I added the html mark up.

You have a few more steps to go before the website and code is finished.

The reason that the selected item is shown in the drop down box twice.... is the simplicity of the code..

As said before the user can still edit the information before going on to the next step.

Geoff

CODE


<?

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>

<!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"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="Images/gpfavicon.ico"/>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Editing, Proofreading and Grammar Checking Service - Grammar Perfection</title>
<!-- InstanceEndEditable -->
<meta name="keywords" content="service,editing,english grammar,proofreading,apa style,writing help,editorial services,essay editing,grammar help,proofread,academic paper,proofreading english,proofreading online,business editorial,proofreading service,proofreading services,business editor,write,college application,apa style,college applications,resume,editorial,resumes,edit document,writing,cover letter,cover letters,editing service,resumes cover letters,writing,apa style,apa,online editor,cbe style,cbe,proofreading essay,english,mla style,mla,editing services,chicago style, financial document,grammer help,financial documents,english writing,academic papers,copy editor,business proofreading,mla style,edit,editor,english grammer,essay help,">
<meta name="description" content="Professional proofreading and editing service. We edit essays, resumes, and other forms of writing. Let our editing specialists proofread your writing today.">
<!--GrammarPerfection.com: writing editing apa style proofreading writing editors english grammar proofreading apa style editing writing apa style editors english grammar mla style writing editing apa style editing mla style proofreading writing english grammar mla style etc.-->
<style type="text/css">
<!--
-->
</style>
<link href="CSS/layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
    background-image: url(Images/background.gif);
}
.style1 {
    font-size: 1px;
    color: #CCCCCC;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<div id="logo"><a href="index.html"><img src="Images/grammar-perfection-proofreading-and-editing-service.jpg" alt="Grammar Perfection we catch what spell check misses" width="620" height="172" /></a></div>
<div id="navigation"><a href="index.html">Home</a> | <a href="submitdocument.html">Submit Document</a> | <a href="guarantee.html">100% Guarantee</a> | <a href="examplesofwork.html">Example of Our Work</a> | <a href="faq.html">FAQ</a> | <a href="recommendafriend.html">Get 1/2 Off Your Next Order</a> | <a href="cost.html">Cost</a></div>
<div id="wrapper">
      <div id="bodyArea">
        <div id="left">
          <h5><a href="index.html"><img src="Images/grammar-perfection-home-icon.jpg" alt="Home for proofreading and editing "class="img" longdesc="../index.html" /><br />
        Home</a></h5>
          <h5><a href="submitdocument.html"><img src="Images/submit-your-document-for-proofreading-editing-icon.jpg" alt="Submit your document for editing and proofreading" name="icons" id="icons" /><br />
        Submit Document</a></h5>
    <h5><a href="guarantee.html"><img src="Images/satisfaction-guaranteed-icon.jpg" alt="We guarantee our proofreading and editing or your money back!" name="icons" id="icons" /><br />
        100% Guarantee!</a></h5>
    <h5><a href="examplesofwork.html"><img src="Images/example-of-what-grammar-perfection-does.jpg" alt="View an example of our proofreading and editing" name="icons" id="icons" /><br />
        Example of Our Work</a></h5>
    <h5><a href="faq.html"><img src="Images/frequently-asked-questions-about-proofreading-editing.jpg" alt="Frequently asked questions about our proofreading and editing service" name="icons" id="icons" /><br />
        Frequently Asked Questions</a></h5>
    <h5><a href="recommendafriend.html"><img src="Images/proofreding-editing-discount.jpg" alt="Get half off your next proofreading and editing service" name="icons" id="icons" /><br />
        Get 1/2 Off Your Next Order!</a></h5>
    <h5><a href="cost.html"><img src="Images/cost-for-proofreading-editing-service.jpg" alt="How much does it cost for proofreading and editing" name="icons" id="icons" /><br />
        How Much Does it Cost?</a></h5>
        </div>
        <div id="right">              <!-- InstanceBeginEditable name="Main Area" -->
          <h1><span class="pagetitle">Checkout </span></h1>
          <table width="620" border="0" align="center" cellpadding="2" cellspacing="2">
            <tr>
              <td class="pagetitle" align="left" nowrap="nowrap" height="20"><div align="center"></div></td>
            </tr>
            <tr>
              <td class="pagetext" valign="top" width="625"><form name="grammarperfection" action="/confirmorder.php" method="post">
                  
                
                <div align="center">
                  <table width="604" border="1" cellpadding="4" cellspacing="0">
                    <tr>
                      <td class="pagetext" width="260"><b>Service Option</b> </td>
                      <td width="322">
                      
<!-- Sean html markup added here -->                      
                    <select name="select">
                      <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
                      <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
                      <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
                      <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
                    </select>
<!-- finish -->    
                      </td>
                    </tr>
                    <tr>
                      <td class="pagetext" width="260"><b>Number of Words</b> (300 Words=1 Page) </td>
                      <td class="pagetext">
<!-- Sean html markup added here -->                          
                      <input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">
<!-- finish -->    
                      <a href="/cost.html">Word Counter/Cost Estimator</a> </td>
                    </tr>
                    <tr>
                      <td class="pagetext"><b>Level of Work</b> </td>
                      <td><select size="1" name="optLevel">
                        <option value="High School">High School</option>
                        <option value="Admission">College - Admission</option>
                        <option value="College - Under Graduate">College - Under Graduate</option>
                        <option value="College - Post Graduate">College - Post Graduate</option>
                        <option value="Website">Website</option>
                        <option value="Business">Business</option>
                        <option value="Other">Other</option>
                        </select>                      </td>
                    </tr>
                    <tr>
                      <td class="pagetext"><b>Writing Format</b> </td>
                      <td><select size="1" name="optFormat">
                        <option value="MLA">MLA</option>
                        <option value="AP">AP</option>
                        <option value="N/A">N/A</option>
                        </select>                      </td>
                    </tr>
                    <tr>
                      <td class="pagetext" colspan="2"><input type="submit" value="Proceed With Order" name="btnOrder" />                      </td>
                    </tr>
                    </table>
                </div>
              </form></td>
            </tr>
          </table>
        <p>&nbsp;</p>
          <p>&nbsp;</p>
        <!-- InstanceEndEditable --></div>
        <div id="footer">
    <p><a href="customerservice.html">Customer Service</a> | <a href="links.html">Links</a> | <a href="employment.html">Employment</a></p>
  </div>
  </div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-3295634-3");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
<!-- InstanceEnd --></html>



This post has been edited by geoffmerritt: Mar 25 2009, 08:02 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 25 2009, 09:18 AM
Post #17


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(geoffmerritt @ Mar 25 2009, 07:31 AM) *

Sean

Have tested, the only problem was the missing ;

Geoff

CODE
<?

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>
<html>
<body>
<select name="select">
  <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
  <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
  <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
  <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">
</body>
</html>



Thanks a million. I can't wait to test it out tonight when I get home!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 25 2009, 09:21 PM
Post #18


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



QUOTE(SeanWoods @ Mar 25 2009, 09:18 AM) *

QUOTE(geoffmerritt @ Mar 25 2009, 07:31 AM) *

Sean

Have tested, the only problem was the missing ;

Geoff

CODE
<?

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

?>
<html>
<body>
<select name="select">
  <option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
  <option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
  <option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
  <option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>
</select>
<input type="text" name="txtWordCount" size="20" maxlength="20" value="<? echo $words; ?>">
</body>
</html>



Thanks a million. I can't wait to test it out tonight when I get home!


One final question on this page if you happen to have a quick answer (I will print out the code tomorrow and examine what might be causing this). Everything populates just like its supposed to (THANKS!), the only thing is that once it populates the selected service option in the drop down box, there is a double of whatever option was selected. In other words, it puts the selected option on top of the three possible options.

So if someone selects that they want "Standard - 3 Day/72 Hour Return - $5.00 Per Page" and then goes on to the next page, in the drop down box, it will have listed as options:

Standard - 3 Day/72 Hour Return - $5.00 Per Page
Standard - 3 Day/72 Hour Return - $5.00 Per Page
Expedite - 2 Day/48 Hour Return - $7.50 Per Page
Overnight - 1 Day/24 Hour Return - $9.00 Per Page
See: http://www.grammarperfection.com/checkout....1&words=280

Or if someone selects that they want "Expedite - 2 Day/48 Hour Return - $7.50 Per Page" and then goes on to the next page, in the drop down box, it will have listed as options:
Expedite - 2 Day/48 Hour Return - $7.50 Per Page
Standard - 3 Day/72 Hour Return - $5.00 Per Page
Expedite - 2 Day/48 Hour Return - $7.50 Per Page
Overnight - 1 Day/24 Hour Return - $9.00 Per Page
See: http://www.grammarperfection.com/checkout....2&words=280


I am sorry I am asking for so much help, but looking at the code, I don't see what needs changed, maybe some sort of an "if" statement or something.


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
SeanWoods
post Mar 25 2009, 09:23 PM
Post #19


Member
***

Group: Members
Posts: 42
Joined: 23-March 09
Member No.: 8,142



I have a feeling something needs to be adjusted here:
<select name="select">
<option value="<?=$servvalue ?>" selected="selected"><?=$serv ?></option>
<option value="1">Standard - 3 Day/72 Hour Return - $5.00 Per Page</option>
<option value="2">Expedite - 2 Day/48 Hour Return - $7.50 Per Page</option>
<option value="3">Overnight - 1 Day/24 Hour Return - $9.00 Per Page</option>


This post has been edited by SeanWoods: Mar 25 2009, 09:28 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Mar 25 2009, 10:48 PM
Post #20


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Remark: if you are going to write php, you _really_ have to sit down and read some introductory stuff, so you understand (basically) the syntax of the language. It is no good trying to get anywhere just stuffing a semicolon here or there "in case it helps"...

CODE
<?

$serv = $_GET['serv']; // retrieves the data and creates a variable called $serv
$words = $_GET['words']; // as above

$servvalue = $serv; // creating  a value to go in the drop down box..

if($serv == 1)
{
$serv = "Standard - 3 Day/72 Hour Return - $5.00 Per Page";
}


if($serv == 2)
{
$serv = "Expedite - 2 Day/48 Hour Return - $7.50 Per Page";
}


if($serv == 3)
{
$serv = "Overnight - 1 Day/24 Hour Return - $9.00 Per Page";
}

...


This is very odd (bad programming style). What is the variable $serv supposed to represent? First it is the GET parameter passed to the page, which is a number. Then it gets to mean something quite different -- the text name corresponding to the number. Much better to have an array to associate the numeric values with their names:

$servnames = array(
1 => 'Standard - 3 Day/72 Hour Return - $5.00 Per Page',
2 => 'Expedite - 2 Day/48 Hour Return - $7.50 Per Page',
3 => 'Overnight - 1 Day/24 Hour Return - $9.00 Per Page');

(Note these should be single-quoted strings, because you don't want $ signs in " " strings.)

Now instead of writing out the names ever again you use $servnames[$n] where $n is whichever you want. In your program as you have it now, this means you can just refer to $serv at any point, and it always means the same thing -- the value passed to the page.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th April 2024 - 11:05 AM