Login|Contact Us
Question and Answer

Programming

Ask a Programming Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

here is the question i asked eljon but never got a response. different

 
TheDoctor's Avatar
  • Answered by:TheDoctor
  • Software Engineer
  • Positive Feedback: 100.0 %
  • Accepted Answers: 411
Verified Expert
in Programming

Recent Feedback

Positive
Type your review here...
Positive
Concise, thorough and understandable. Truly knowledgeable! I cannot thank you...
Positive
Awesome, fast results
Positive
I would like to use you for future assignments.
Positive
Very fast!!! Will be using again and again.
Positive
Fast
Positive
Helped me out immensely.
Positive
better alternative to what i wanted
Positive
very well explained
Positive
Fast!

Customer Question

here is the question i asked eljon but never got a response.

different site.

i have two files. one collects information via buttons and input. then the information is processed by the second file. the information that is input by user transfers fine and can process but the button selected info does not transfer.

when you look, you will see that each selected field has a dollar amount calculated with it. its these dollars that i need to transfer as well as the result. i uploaded in a zip.

here it is:

http://wikisend.com/download/697522/dddquote.zip

 

Optional Information:
Language (or Software): PHP

Submitted: 314 days and 14 hours ago.
Category: Programming
Value: $45
Status: CLOSED
Picture
Expert:  TheDoctor replied314 days and 14 hours ago.

Thank you. I will review and get back go you soon.

Customer replied314 days and 14 hours ago.

ok

Picture
Expert:  TheDoctor replied314 days and 13 hours ago.

Hi David,

I realize that you were told to use a $_SESSION variable. However, this will not work.

In the first file, dddquote.php, you are, throughout the file, setting various price variables. For instance:

$linksYes=$_POST['linksYes'];
$linksYes='Yes';
if ($linksYes == 'Yes'){$linksYesPrice=12;} // estimating 4 links
if ($linksYes == 'No'){$linksYesPrice=0;}


First of all, I am assuming you are setting the variable to a static value on the second line for testing purposes. But this code will never work.

The $_POST variable will have information in it only when a form with the post method has been submitted. Since this form does not submit to itself, $_POST['linksYes'] will ALWAYS be an undefined variable.

Calculated the price on this page and then sending it to the processing page will not work. You are calculating the price based on items selected in the form. So, it makes since for you to calculate the the price in the second form, after the form has been submitted.

Get rid of all the session variable stuff. You do not need it.

Remove every instance of the code that is similar to what I posted above. There are a few of them. Also, remove the code where you set the price by adding all of these variables together.

Then place it all at the top of the second file, dddquote2.php. In the second file, these $_POST fields will already be set, so you will be able to use actual prices rather than the test static values you have put in.

When you, at the end of all these blocks, add up all the variables, set it to $price, not $_SESSION['price']

Your other professional is correct that you need to use session variables to pass variables between pages. However, this is a case where passing variables between pages will never work, so it is not a valid solution.

If you have any difficulty implementing this, go ahead and send me whatever work you have done to try and implement it and I will take a look.

Thank you.TheDoctor41099.7373418171

Customer replied314 days and 10 hours ago.

i made all the changes but i can't tell if it works, now the dddquote2.php runs to completion with no errors but it doesn't appear to meet one of the if conditions, as far as i can tell where it writes to the dbms its not meeting the requirements. whats up?


http://wikisend.com/download/147756/dddquote2.php

Picture
Expert:  TheDoctor replied314 days and 10 hours ago.

I'll take a look. What do you mean by it not meeting the requirements? What requirements are you referring to?

Customer replied314 days and 10 hours ago.

at the bottom there is an if statement that validates that there is data in the address fields, it passes that because it doesn't show an error message. the else statement should then execute but it doesn't and the screen just refreshes and returns to a blank input form. it should be emailing me, posting to a table and displaying the results to the screen. none of this is happening. its something with the if statement but i don't know what. it did work fine before i added all the information at the top as you suggested. i don't see any relationshhip but thats what happened

Picture
Expert:  TheDoctor replied314 days and 10 hours ago.

I see it now.

The post items will never be equal to false. Wether an individual enters data or not, the form gets posted. If the user did not enter anything, the variables will be an empty string.

You want to replace this line:

if ($fname == false || $lname == false || $address == false || $city == false || $state == false || $zip == false || $email == false || $tele == false) {

With this:

if(str_replace(" ", "", $fname) == "" || str_replace(" ", "", $lname) == "" || str_replace(" ", "", $address) == "" || str_replace(" ", "", $city) == "" || str_replace(" ", "", $state) == "" || str_replace(" ", "", $zip) == "" || str_replace(" ", "", $email) == "" || str_replace(" ", "", $tele) == "") {

Customer replied314 days and 10 hours ago.

ok, change made, symptom now....it fails then just returns to screen, then fails then returns to screen, etc.....


 


it seems to be getting some information 1/2 the time and not the other half.


 


even when it finda a match it doesn't do the else statement, no table writing and no email and no display to page, just returns to screen

Picture
Expert:  TheDoctor replied314 days and 10 hours ago.

Please send me both files.

Customer replied314 days and 10 hours ago.

http://wikisend.com/download/304690/dddquote.zip

Accepted Answer

Picture
Expert:  TheDoctor replied314 days and 9 hours ago.

Start at around line 54, you have a series of isset checks, wherein you set the variables that we later check for. However, it looks like you made a copy/paste error. Almost every isset is resetting $event instead of setting the correct variable. Also, you are resetting the $price variable that you just calculated. Do not do that. Here is the corrected code:

if(isset($_POST['event'])) {
$event=$_POST['event'];
} else {
$event="";
}
if(isset($_POST['fname'])) {
$fname=$_POST['fname'];
} else {
$fname="";
}
if(isset($_POST['lname'])) {
$lname=$_POST['lname'];
} else {
$lname="";
}
if(isset($_POST['address'])) {
$address=$_POST['address'];
} else {
$address="";
}
if(isset($_POST['address2'])) {
$address2=$_POST['address2'];
} else {
$address2="";
}
if(isset($_POST['city'])) {
$city=$_POST['city'];
} else {
$city="";
}
if(isset($_POST['state'])) {
$state=$_POST['state'];
} else {
$state="";
}
if(isset($_POST['zip'])) {
$zip=$_POST['zip'];
} else {
$zip="";
}
if(isset($_POST['tele'])) {
$tele=$_POST['tele'];
} else {
$tele="";
}
if(isset($_POST['email'])) {
$email=$_POST['email'];
} else {
$email="";
}
if(isset($_POST['comment'])) {
$comment=$_POST['comment'];
} else {
$comment="";
}
if(isset($_POST['box1'])) {
$box1=$_POST['box1'];
} else {
$box1="";
}
if(isset($_POST['addressYes'])) {
$addressYes=$_POST['addressYes'];
} else {
$addressYes="";
}
if(isset($_POST['addressurl'])) {
$addressurl=$_POST['addressurl'];
} else {
$addressurl="";
}
if(isset($_POST['typeP'])) {
$typeP=$_POST['typeP'];
} else {
$typeP="";
}
if(isset($_POST['siteYes'])) {
$siteYes=$_POST['siteYes'];
} else {
$siteYes="";
}
if(isset($_POST['site'])) {
$site=$_POST['site'];
} else {
$site="";
}
if(isset($_POST['pages'])) {
$pages=$_POST['pages'];
} else {
$pages="";
}
if(isset($_POST['linksYes'])) {
$linksYes=$_POST['linksYes'];
} else {
$linksYes="";
}
if(isset($_POST['storeYes'])) {
$storeYes=$_POST['storeYes'];
} else {
$storeYes="";
}
if(isset($_POST['store'])) {
$store=$_POST['store'];
} else {
$store="";
}
if(isset($_POST['techYes'])) {
$techYes=$_POST['techYes'];
} else {
$techYes="";
}
if(isset($_POST['tech'])) {
$tech=$_POST['tech'];
} else {
$tech="";
}
if(isset($_POST['uploadYes'])) {
$uploadYes=$_POST['uploadYes'];
} else {
$uploadYes="";
}
if(isset($_POST['upload'])) {
$upload=$_POST['upload'];
} else {
$upload="";
}
if(isset($backupYes)) {
$backupYes=$_POST['backupYes'];
} else {
$backupYes="";
}
if(isset($_POST['businessYes'])) {
$businessYes=$_POST['businessYes'];
} else {
$businessYes="";
}
if(isset($_POST['copywriteYes'])) {
$copywriteYes=$_POST['copywriteYes'];
} else {
$copywriteYes="";
}
if(isset($_POST['hear'])) {
$hear=$_POST['hear'];
} else {
$hear="";
}
if(isset($_POST['hearWho'])) {
$hearWho=$_POST['hearWho'];
} else {
$hearWho="";
}


Expert TypeSoftware Engineer
Category: Programming
Pos. Feedback: 100.0 %
Accepts: 411
Answered: 7/9/2012

Experience: M.S. in Internet Information Systems

Ask this Expert a Question >
 
Tweet

Programmers are Online Right Now

Ask Your Question Now
Programming Questions Date Submitted
Microsoft Visual Basic 2010 Programming Exercise 5/16/2013
I am programming and auto reply macro and Outlook 10 that is 5/16/2013
Hello. I really need help with C Programming. I need a program 5/15/2013
I need to make the submit button bigger 5/15/2013
"For Jatechexpert" Part 1Programming Exercise 2—Calories 5/14/2013
INSTRUCTIONS: VERY IMPORTANT, THIS IS TO BE DONE USING MICROSOFT 5/13/2013
I have a JavaScript programming question. I have a form and 5/13/2013
Need a java programming to fulfill the following requirements: 1. 5/13/2013
I. Overview: Welcome to the CIT216 Practice Final 5/13/2013
Please help with this project https://www.dropbox.com/s/vs 5/12/2013
RSS
Next 10 >
Ask A Programmer
Type Your Programming Question Here...
characters left:

Top Programming Experts

See More Programmers

JustAnswer in the News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More
close
Find Expert answers related to your question.
Sign up using email
We will never post anything without your permission.
Already have an account? Sign in

Ask a Programmer

Get a Professional Answer. 100% Satisfaction Guaranteed.
68 Programmers are Online Now
Type Your Programming Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us | Our Network
© 2003-2013 JustAnswer LLC
  • Pearl.com
  • JustAnswer UK
  • JustAnswer Germany
  • JustAnswer Spanish
  • JustAnswer Japan