php error message
- cleartango
- Newbie


- Joined: Oct 29, 2009
- Posts: 7
- Status: Offline
Hi
I have a php form processing script set up.
When my form is submitted, my users should be transferred to a webpage depending on what answer they give to a question, however they are currently seeing the following error message.
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 71
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 73
Warning: Cannot modify header information - headers already sent by (output started at /home/barf1/public_html/anothertry4.php:3) in /home/barfutu1/public_html/anothertry4.php on line 76
Any ideas what I need to do to rectify this situation? Does my code need tweaking? And if so how? php code is enclosed below:
Would be grateful for any help
Mick
I have a php form processing script set up.
When my form is submitted, my users should be transferred to a webpage depending on what answer they give to a question, however they are currently seeing the following error message.
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 71
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 73
Warning: Cannot modify header information - headers already sent by (output started at /home/barf1/public_html/anothertry4.php:3) in /home/barfutu1/public_html/anothertry4.php on line 76
Any ideas what I need to do to rectify this situation? Does my code need tweaking? And if so how? php code is enclosed below:
PHP Code: [ Select ]
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
$to = "emailaddress";
$to2 = "emailaddress";
$to3 = "emailaddress";
$from = $_REQUEST['contactemail'] ;
$name = $_REQUEST['contactname'] ;
$headers = "From: $from";
$subject = "Request for Conference Places in York on Dec 10";
$fields = array();
$fields{'contactname'} = " Contact Name";
$fields{'contactemail'} = " Contact Email";
$fields{'contactphone'} = " Contact Phone";
$fields{'contactaddress'} = " Contact Address";
$fields{'organisation'} = " Organisation";
$fields{'delegate1name'} = "Del 1 NAME";
$fields{'delegate1job'} = "Del 1 JOB";
$fields{'delegate1email'} = " Del 1 EMAIL";
$fields{'delegate2name'} = "Del 2 NAME";
$fields{'delegate2job'} = "Del 2 JOB";
$fields{'delegate2email'} = " Del 2 EMAIL";
$fields{'delegate3name'} = "Del 3 NAME";
$fields{'delegate3job'} = "Del 3 JOB";
$fields{'delegate3email'} = " Del 3 EMAIL";
$fields{'delegate4name'} = "Del 4 NAME";
$fields{'delegate4job'} = "Del 4 JOB";
$fields{'delegate4email'} = " Del 4 EMAIL";
$fields{'delegate5name'} = "Del 5 NAME";
$fields{'delegate5job'} = "Del 5 JOB";
$fields{'delegate5email'} = " Del 5 EMAIL";
$fields{'delegate6name'} = "Del 6 NAME";
$fields{'delegate6job'} = "Del 6 JOB";
$fields{'delegate6email'} = " Del 6 EMAIL";
$fields{'delegate7name'} = "Del 7 NAME";
$fields{'delegate7job'} = "Del 7 JOB";
$fields{'delegate7email'} = " Del 7 EMAIL";
$fields{'delegate8name'} = "Del 8 NAME";
$fields{'delegate8job'} = "Del 8 JOB";
$fields{'delegate8email'} = " Del 8 EMAIL";
$fields{'delegate9name'} = "Del 9 NAME";
$fields{'delegate9job'} = "Del 9 JOB";
$fields{'delegate9email'} = " Del 9 EMAIL";
$fields{'delegate10name'} = "Del 10 NAME";
$fields{'delegate10job'} = "Del 10 JOB";
$fields{'delegate10email'} = " Del 10 EMAIL";
$fields{'payment'} = " Payment";
$fields{'terms'} = "Terms";
$body = "Request for Conference Places in York on Dec 10:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: emailaddress";
$subject2 = "Managing the Evening and Night-time Economy in Yorkshire and Humber";
$autoreply = "Thank you for your reservation for the 'Managing the Evening and Night-time Economy in Yorkshire and Humber' conference.
Your conference places will be confirmed once we have received your payment. Conference details and a conference preference questionnaire will be sent to you shortly.
If you have chosen to pay by BACS and you do NOT receive a proforma within 24 hours or if you have any questions, please contact us on emailaddress";
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
$send3 = mail($to2, $subject, $body, $headers);
$send4 = mail($to3, $subject, $body, $headers);
if($payment=="bacs")
{header("Location: url"); exit(); }
elseif($payment=="card")
{header("Location: url"); exit(); }
else
{header("Location: url"); exit(); }
?>
ini_set("display_errors", "1");
error_reporting(E_ALL);
$to = "emailaddress";
$to2 = "emailaddress";
$to3 = "emailaddress";
$from = $_REQUEST['contactemail'] ;
$name = $_REQUEST['contactname'] ;
$headers = "From: $from";
$subject = "Request for Conference Places in York on Dec 10";
$fields = array();
$fields{'contactname'} = " Contact Name";
$fields{'contactemail'} = " Contact Email";
$fields{'contactphone'} = " Contact Phone";
$fields{'contactaddress'} = " Contact Address";
$fields{'organisation'} = " Organisation";
$fields{'delegate1name'} = "Del 1 NAME";
$fields{'delegate1job'} = "Del 1 JOB";
$fields{'delegate1email'} = " Del 1 EMAIL";
$fields{'delegate2name'} = "Del 2 NAME";
$fields{'delegate2job'} = "Del 2 JOB";
$fields{'delegate2email'} = " Del 2 EMAIL";
$fields{'delegate3name'} = "Del 3 NAME";
$fields{'delegate3job'} = "Del 3 JOB";
$fields{'delegate3email'} = " Del 3 EMAIL";
$fields{'delegate4name'} = "Del 4 NAME";
$fields{'delegate4job'} = "Del 4 JOB";
$fields{'delegate4email'} = " Del 4 EMAIL";
$fields{'delegate5name'} = "Del 5 NAME";
$fields{'delegate5job'} = "Del 5 JOB";
$fields{'delegate5email'} = " Del 5 EMAIL";
$fields{'delegate6name'} = "Del 6 NAME";
$fields{'delegate6job'} = "Del 6 JOB";
$fields{'delegate6email'} = " Del 6 EMAIL";
$fields{'delegate7name'} = "Del 7 NAME";
$fields{'delegate7job'} = "Del 7 JOB";
$fields{'delegate7email'} = " Del 7 EMAIL";
$fields{'delegate8name'} = "Del 8 NAME";
$fields{'delegate8job'} = "Del 8 JOB";
$fields{'delegate8email'} = " Del 8 EMAIL";
$fields{'delegate9name'} = "Del 9 NAME";
$fields{'delegate9job'} = "Del 9 JOB";
$fields{'delegate9email'} = " Del 9 EMAIL";
$fields{'delegate10name'} = "Del 10 NAME";
$fields{'delegate10job'} = "Del 10 JOB";
$fields{'delegate10email'} = " Del 10 EMAIL";
$fields{'payment'} = " Payment";
$fields{'terms'} = "Terms";
$body = "Request for Conference Places in York on Dec 10:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: emailaddress";
$subject2 = "Managing the Evening and Night-time Economy in Yorkshire and Humber";
$autoreply = "Thank you for your reservation for the 'Managing the Evening and Night-time Economy in Yorkshire and Humber' conference.
Your conference places will be confirmed once we have received your payment. Conference details and a conference preference questionnaire will be sent to you shortly.
If you have chosen to pay by BACS and you do NOT receive a proforma within 24 hours or if you have any questions, please contact us on emailaddress";
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
$send3 = mail($to2, $subject, $body, $headers);
$send4 = mail($to3, $subject, $body, $headers);
if($payment=="bacs")
{header("Location: url"); exit(); }
elseif($payment=="card")
{header("Location: url"); exit(); }
else
{header("Location: url"); exit(); }
?>
- <?php
- ini_set("display_errors", "1");
- error_reporting(E_ALL);
- $to = "emailaddress";
- $to2 = "emailaddress";
- $to3 = "emailaddress";
- $from = $_REQUEST['contactemail'] ;
- $name = $_REQUEST['contactname'] ;
- $headers = "From: $from";
- $subject = "Request for Conference Places in York on Dec 10";
- $fields = array();
- $fields{'contactname'} = " Contact Name";
- $fields{'contactemail'} = " Contact Email";
- $fields{'contactphone'} = " Contact Phone";
- $fields{'contactaddress'} = " Contact Address";
- $fields{'organisation'} = " Organisation";
- $fields{'delegate1name'} = "Del 1 NAME";
- $fields{'delegate1job'} = "Del 1 JOB";
- $fields{'delegate1email'} = " Del 1 EMAIL";
- $fields{'delegate2name'} = "Del 2 NAME";
- $fields{'delegate2job'} = "Del 2 JOB";
- $fields{'delegate2email'} = " Del 2 EMAIL";
- $fields{'delegate3name'} = "Del 3 NAME";
- $fields{'delegate3job'} = "Del 3 JOB";
- $fields{'delegate3email'} = " Del 3 EMAIL";
- $fields{'delegate4name'} = "Del 4 NAME";
- $fields{'delegate4job'} = "Del 4 JOB";
- $fields{'delegate4email'} = " Del 4 EMAIL";
- $fields{'delegate5name'} = "Del 5 NAME";
- $fields{'delegate5job'} = "Del 5 JOB";
- $fields{'delegate5email'} = " Del 5 EMAIL";
- $fields{'delegate6name'} = "Del 6 NAME";
- $fields{'delegate6job'} = "Del 6 JOB";
- $fields{'delegate6email'} = " Del 6 EMAIL";
- $fields{'delegate7name'} = "Del 7 NAME";
- $fields{'delegate7job'} = "Del 7 JOB";
- $fields{'delegate7email'} = " Del 7 EMAIL";
- $fields{'delegate8name'} = "Del 8 NAME";
- $fields{'delegate8job'} = "Del 8 JOB";
- $fields{'delegate8email'} = " Del 8 EMAIL";
- $fields{'delegate9name'} = "Del 9 NAME";
- $fields{'delegate9job'} = "Del 9 JOB";
- $fields{'delegate9email'} = " Del 9 EMAIL";
- $fields{'delegate10name'} = "Del 10 NAME";
- $fields{'delegate10job'} = "Del 10 JOB";
- $fields{'delegate10email'} = " Del 10 EMAIL";
- $fields{'payment'} = " Payment";
- $fields{'terms'} = "Terms";
- $body = "Request for Conference Places in York on Dec 10:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
- $headers2 = "From: emailaddress";
- $subject2 = "Managing the Evening and Night-time Economy in Yorkshire and Humber";
- $autoreply = "Thank you for your reservation for the 'Managing the Evening and Night-time Economy in Yorkshire and Humber' conference.
- Your conference places will be confirmed once we have received your payment. Conference details and a conference preference questionnaire will be sent to you shortly.
- If you have chosen to pay by BACS and you do NOT receive a proforma within 24 hours or if you have any questions, please contact us on emailaddress";
- $send = mail($to, $subject, $body, $headers);
- $send2 = mail($from, $subject2, $autoreply, $headers2);
- $send3 = mail($to2, $subject, $body, $headers);
- $send4 = mail($to3, $subject, $body, $headers);
- if($payment=="bacs")
- {header("Location: url"); exit(); }
- elseif($payment=="card")
- {header("Location: url"); exit(); }
- else
- {header("Location: url"); exit(); }
- ?>
Would be grateful for any help
Mick
Moderator Remark: Added [php] tags around code
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
November 23rd, 2009, 9:11 am
- spork
- Brewmaster


- Joined: Sep 22, 2003
- Posts: 6130
- Loc: Seattle, WA
- Status: Offline
- cleartango
- Newbie


- Joined: Oct 29, 2009
- Posts: 7
- Status: Offline
- cleartango
- Newbie


- Joined: Oct 29, 2009
- Posts: 7
- Status: Offline
Have got rid of whitespace in the code...and now there seems to be a new issue ...
When it gets to this:
Code: [Select]
69. if($payment=="bacs")
70. {header("Location: url"); exit(); }
71. elseif($payment=="card")
72. {header("Location: url"); exit(); }
73. else
74. {header("Location: url"); exit(); }
even if payment =="bacs" or "card" it just does the action required if neither of these is true, which in this case means returning the form for user to complete anew.
Anybody have any thoughts on why this is happening or how to tackle it?
Thanks
Mick
When it gets to this:
Code: [Select]
69. if($payment=="bacs")
70. {header("Location: url"); exit(); }
71. elseif($payment=="card")
72. {header("Location: url"); exit(); }
73. else
74. {header("Location: url"); exit(); }
even if payment =="bacs" or "card" it just does the action required if neither of these is true, which in this case means returning the form for user to complete anew.
Anybody have any thoughts on why this is happening or how to tackle it?
Thanks
Mick
- cleartango
- Newbie


- Joined: Oct 29, 2009
- Posts: 7
- Status: Offline
Thanks!!
the user enters payment type as shown in the html based on one of two checkbox.
it's currently returning as if no payment is submitted.
I've added in echo $payment; but it's not giving me any info, however as it's taking the action as if no payment type submitted i'm guessing it's not using that info as it should.
i added this into the code
this tells me
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 69
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 70
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 72
Warning: Cannot modify header information - headers already sent by (output started at /home/barfutu1/public_html/anothertry4.php:69) in /home/barfutu1/public_html/anothertry4.php on line 75
Am a newbie at this, so how do I define the $payment variable? what's the code for that? I would have thought that the variable would be defined when the user checks a checkbox and then used to go to the correct url. Despite what the code says all the urls are different.
Thanks guys!!!
Mick
the user enters payment type as shown in the html based on one of two checkbox.
Code: [ Select ]
<tr>
<td colspan="3" class="labelcell" width="400"><font size="2"><label for="card">Debit/Credit card</label></font></td>
<td> <input type="radio" name="payment" id="payment" value="card" tabindex="36"></td>
</tr>
<tr>
<td colspan="3" class="labelcell"><font size="2"><label for="bacs">BACS transfer</label></font></td>
<td><input type="radio" name="payment" id="payment" value="bacs" tabindex="37"></td>
</tr>
<td colspan="3" class="labelcell" width="400"><font size="2"><label for="card">Debit/Credit card</label></font></td>
<td> <input type="radio" name="payment" id="payment" value="card" tabindex="36"></td>
</tr>
<tr>
<td colspan="3" class="labelcell"><font size="2"><label for="bacs">BACS transfer</label></font></td>
<td><input type="radio" name="payment" id="payment" value="bacs" tabindex="37"></td>
</tr>
- <tr>
- <td colspan="3" class="labelcell" width="400"><font size="2"><label for="card">Debit/Credit card</label></font></td>
- <td> <input type="radio" name="payment" id="payment" value="card" tabindex="36"></td>
- </tr>
- <tr>
- <td colspan="3" class="labelcell"><font size="2"><label for="bacs">BACS transfer</label></font></td>
- <td><input type="radio" name="payment" id="payment" value="bacs" tabindex="37"></td>
- </tr>
it's currently returning as if no payment is submitted.
I've added in echo $payment; but it's not giving me any info, however as it's taking the action as if no payment type submitted i'm guessing it's not using that info as it should.
i added this into the code
Code: [ Select ]
ini_set("display_errors", "1");
error_reporting(E_ALL);
error_reporting(E_ALL);
- ini_set("display_errors", "1");
- error_reporting(E_ALL);
this tells me
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 69
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 70
Notice: Undefined variable: payment in /home/barfutu1/public_html/anothertry4.php on line 72
Warning: Cannot modify header information - headers already sent by (output started at /home/barfutu1/public_html/anothertry4.php:69) in /home/barfutu1/public_html/anothertry4.php on line 75
Am a newbie at this, so how do I define the $payment variable? what's the code for that? I would have thought that the variable would be defined when the user checks a checkbox and then used to go to the correct url. Despite what the code says all the urls are different.
Thanks guys!!!
Mick
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 6 posts
- Users browsing this forum: No registered users and 203 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
