/    Sign up×
Community /Pin to ProfileBookmark

What is wrong with this code??

Hey,

I’m trying to determine which product the user clicks on. When they click the buy now button, a form is submitted to this page one of the fields is

[code]
<form action=”AppRequest.php” method=”POST”>
<input name=”COMPANY” type=”hidden” value=”$company$”>
<then the submit button>
</form>
[/code]

Now in AppRequest.php I am trying to determine the company name that the user clicked but it isn’t working.

[code]
<?PHP
if($_POST[‘COMPANY’] == “The Canada Life Assurance Company”){
echo $_POST[‘COMPANY’];
}else{
echo “Could not determine the company selected.”;
}
?>
[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceDec 31.2004 — And if you do it like this, what does the first output line look like?
[code=php]<?PHP
echo $_POST['COMPANY'];
if($_POST['COMPANY'] == "The Canada Life Assurance Company"){
echo "Matched!";
}else{
echo "Could not determine the company selected.";
}
?>
[/code]
Copy linkTweet thisAlerts:
@zincoxideauthorDec 31.2004 — http://www.rsptime.ca/TermInsurance/

If you go there you can see what it does. It will take you to a quotation page. Just click Get My Quote with the default values. Then the list of results will show. Click on the Check Mark under Apply Now and you will see what happens.

It doesn't matter if you click on the Canada life one or on a different one... it still says that it couldn't find the selected company.
Copy linkTweet thisAlerts:
@phpnoviceDec 31.2004 — Are you aware that, depending upon the form, there are two different pages (both named the same) that are receiving the data? ...just want to make sure you're changing and examining the correct page.
Copy linkTweet thisAlerts:
@zincoxideauthorDec 31.2004 — No... I am not aware of anything with php. I have no clue what I am doing. This is the first time I have tried to venture into php.

If you could clarify what you mean I would appreciate it.
Copy linkTweet thisAlerts:
@phpnoviceDec 31.2004 — The PHP pages actioned behind the [b]Apply Now[/b] button and actioned behind the [b]More Info[/b] button are both named the same thing -- but in different paths. I just want to make sure you are looking at the correct document at which you think you're looking.
Copy linkTweet thisAlerts:
@zincoxideauthorDec 31.2004 — Oh... That I new...

When I run it I know the value of $_POST['COMPANY'] is actually

The Canada Life Assurance Company

However, when I try to see if the above statment matchs $_POST['COMPANY']

it isn't identifing the string.
×

Success!

Help @zincoxide spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...