How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor
TheDoctor, Software Engineer
Category: Programming
Satisfied Customers: 1463
Experience:  M.S. in Internet Information Systems
59032869
Type Your Programming Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

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

Resolved 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
Submitted: 2 years ago.
Category: Programming
Expert:  TheDoctor replied 2 years ago.
Thank you. I will review and get back go you soon.
Customer: replied 2 years ago.
ok
Expert:  TheDoctor replied 2 years 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.
Customer: replied 2 years 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

Expert:  TheDoctor replied 2 years ago.
I'll take a look. What do you mean by it not meeting the requirements? What requirements are you referring to?
Customer: replied 2 years 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
Expert:  TheDoctor replied 2 years 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: replied 2 years 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

Expert:  TheDoctor replied 2 years ago.
Please send me both files.
Customer: replied 2 years ago.
Expert:  TheDoctor replied 2 years 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="";
}


TheDoctor, Software Engineer
Category: Programming
Satisfied Customers: 1463
Experience: M.S. in Internet Information Systems
TheDoctor and 6 other Programming Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)