Solved

Transfering ASP form to PHP

Posted on 2007-11-19
7
174 Views
Last Modified: 2008-02-01
I have a form in ASP and I want to convert it to PHP and I am stuck on the basis, I know it will involve calculations and store the ad text and weeks to run, etc What I have pasted is what I have above.

Here is what i am trying to do but in PHP - http://www.starmedianetwork.com/o-ifpa.aspx

After you run it it brings you to fill in the name, address, etc. I am thinking just having it on one page. Any other suggestions on the rest? I am stuck on that part, I know it will involve getting a word count calculating the number of words by the price.

Would this work - http://ordinarywebguy.wordpress.com/2006/09/22/getting-a-number-of-words-in-a-string-using-php/ for getting the number?

Thanks!

Ryan

<?php

	$weeks    = $_REQUEST["weeks"];

	$ad       = $_REQUEST["ad"];

	$fn       = $_REQUEST["fn"];

	$ln       = $_REQUEST["ln"];

	$company  = $_REQUEST["company"];

	$email    = $_REQUEST["email"];

	$phone    = $_REQUEST["phone"];

	$date     = $_REQUEST["date"];

	$comments = $_REQUEST["comments"];

	$price    = "565";                 // price for ad

	

?>	

<h3>Step 1 - Ad Text</h3>

<form name="calculate" action="#" />

	<label for="name">Weeks to run ad:</label>

	<select name="name">

		<option value="1">1</option>

		<option value="2">2</option>

		<option value="3">3</option>

		<option value="4">4</option>

	</select><br />

	<p>$565 - 15 words</p>

	<label for="ad">Ad Text:</label>

	<textarea name="ad" rows="5" cols="15"></textarea><br />

	

	<label for="fn">First Name:</label>

	<input type="text" name="fn" /><br />

	<label for="ln">Last Name:</label>

	<input type="text" name="ln" /><br />

	<label for="company">Company Name:</label>

	<input type="text" name="company" /><br />

	<label for="email">E-mail:</label>

	<input type="text" name="fn" /><br />

	<label for="phone">Phone:</label>

	<input type="text" name="phone" /><br />

	<label for="date">Starting Date:</label>

	<input type="text" name="date" /><br />

	<label for="comments">Comments:</label>

	<textarea name="comments" rows="5" cols="15"></textarea><br />

	

	<input type="submit" name="submit" value="Calculate!" />

</form>

Open in new window

0
Comment
  • 4
  • 3
7 Comments
 
LVL 16

Accepted Solution

by:
alain34 earned 500 total points
ID: 20318861
Hello catonthecouchproductions,

The number of word in the comments could be found as follow:
$arrayWord = split(' ',$comments);
$countWord = count($arrayWord);

Regards,

alain34
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20319339
So those two lines willl work for getting the word count of the textarea? And then from there I can do a simple calculation

$cost = $countword * $price;

Is that right?
0
 
LVL 16

Expert Comment

by:alain34
ID: 20319383
Doing that you will charge $565 per word.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20319400
I should have added a "." haha Some of the ads will have:

   $25 words = $1195
   Additional Words = $45

How would I go about grouping that?

0
 
LVL 16

Expert Comment

by:alain34
ID: 20319413
Sorry, I don't understand
$25 words = $1195

Do you mean
25 words = $1195

is the rule 15 words = $565 still valid?
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20323229
That was my bad, sorry for the mistake. Yeah, I meant some will have:

25 words for $1195, and in the long run I want to hook it up to a DB and pull each value out therre will be a bunch

Ryan
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20325238
Any word on how I would do that?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now