Im stumped. Can anyone help?

Alright, let me just get this out of the way right now. Yes, I am a student. And yes, I am working on a project for class… HOWEVER: I am not posting the full project asking for help. I am simply posting what I am having trouble with. So please, DO NOT start saying that Im trying to get everyone to do my work for me. Simply because that isnt true. So if your going to try to flame or bash me right now, stop reading and leave this post.

For those of you who are genuinly interested in helping me figure out this problem, here it is:

Last week when I submitted my code, it worked fine. I submitted my information and it printed out the receipt with all the information I need. Now I need to add to that code to add more information. Somewhere along the line, something got messed up and I cannot figure out why. The page no longer prints the receipt, but instead it prints me this:

“); //if(!empty($name)) //{die(‘ERROR: Please enter your name.’); //} //else{ //echo $name; //}; if (!empty($name) == true) { echo “ERROR: Please enter your name.”; } else { echo $name; } print (”
“); if(empty($address)) {die(‘ERROR: Please enter your address.’); } else{ echo $address; }; print (”
“); if(empty($city)) {die(‘ERROR: Please enter your city.’); } else{ echo $city; }; print (”
“); if(empty($state)) {die(‘ERROR: Please enter your state.’); } else{ echo $state; }; print (”
“); if(empty($zip)) {die(‘ERROR: Please enter your zip code.’); } else{ echo $zip; }; print (”
“); //if (!preg_match(’/^\([0-9]{3}\) [0-9]{3}-[0-9]{4}$/’, $phone)); //{die(‘ERROR: Please provide your phone number in form (ddd) ddd-dddd.’); //} if ( !preg_match(”/^\([0-9]{3}\) [0-9]{3}-[0-9]{4}$/", $phone ) ) {die(“ERROR: Please provide your phone number in form (ddd) ddd-dddd.”); } ?>

Here is the php file thats giving me this:

<?php extract($_POST); echo 'Here is your order.'; print ("
"); //if(!empty($name)) //{die('ERROR: Please enter your name.'); //} //else{ //echo $name; //}; if (!empty($name) == true) { echo "ERROR: Please enter your name."; } else { echo $name; }; print ("
"); if(empty($address)) {die('ERROR: Please enter your address.'); } else{ echo $address; }; print ("
"); if(empty($city)) {die('ERROR: Please enter your city.'); } else{ echo $city; }; print ("
"); if(empty($state)) {die('ERROR: Please enter your state.'); } else{ echo $state; }; print ("
"); if(empty($zip)) {die('ERROR: Please enter your zip code.'); } else{ echo $zip; }; print ("
"); //if (!preg_match('/^\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}$/', $phone)); //{die('ERROR: Please provide your phone number in form (ddd) ddd-dddd.'); //} if ( !preg_match("/^\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}$/", $phone ) ) {die("ERROR: Please provide your phone number in form (ddd) ddd-dddd."); }; ?>

Can someone please help me figure out what I did wrong? This is only the first step of a long list of problems Im running in to and Im starting to get extremely discouraged.

You already have another thread going about this. If your script is outputting PHP code to the browser, you most likely forgot an opening <?php tag

I’ll also guess that you might not be initializing session_start(); or whatever array your using for the post , but like I said I wouldn’t use extract and have no idea why your instructor is insisting on using it? It is what it is. :smiley: However, it’s more likely that you don’t <?php written right like already stated.

That was my initial thought, but no I have checked multiple times and have had other people look for me, and I did not miss a tag.

And yes I realize I have a thread open about this, but no one felt like answering me in that one anymore so I moved it to here…

Sponsor our Newsletter | Privacy Policy | Terms of Service