I'm new to this site - So I apologise if I've done anything wrong.
Basically, I currently have a PHP (and javascript) Paypal form, which provides 9 drop-down questions to my customers. After they have entered this data, they are then able to click a Paypal button and the price automatically shows with the amount dependant on their choices.
However, as Paypal has a description limit - I was wondering if it's possible for this form to send the user a Paypal page, and then send me an email with their data entry too.
It's for a Custom Gaming Controller business, so I need to know ALL of their personalisation choices.
A database seems too complicated... As I will constantly keep updating the choices.
I have the dropdown bit sorted, and the Paypal button sorted. It all works completely fine using .csv files for the variables and prices. However, I need it to send an email to myself.
Can anyone do this?
If you need to see the current code, just let me know. Could really do with someone doing this for me. Will happily provide a detailed review for your potential clients.
<?php
class Controller {
public $currency;
public $shipping;
public $controllerDir = '';
public $question_four;
public $question_five;
public $question_six;
public $question_seven;
public $question_eight;
public $question_nine;
public $question_ten;
public $question_eleven;
public $question_twelve;
public $show_question_four = false;
public $show_question_five = false;
public $show_question_six = false;
public $show_question_seven = false;
public $show_question_eight = false;
public $show_question_nine = false;
public $show_question_ten = false;
public $show_question_eleven = false;
public $show_question_twelve = false;
public function readCSV( $file_name ) {
if ( file_exists($file_name) ) {
$this->options = '';
$file = fopen( $file_name, 'r' );
while ($row = fgetcsv($file)) {
$this->options .= '<option value="' . $row[1] . '">' . $row[0] . '</option>';
}
}
else
$this->options = '<option value="">- Please answer question above -</option>';
return $this->options;
}
public function ShowControllerForm() {
?>
<div id="ctrl_wrapper">
<form id="ctrlForm" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<table>
<tr>
<th style="text-align: left">
<H1>Controller Customization</H1>
</th>
</tr>
<tr>
<td>
Would you like to customise a brand new controller or send in your own?
<br />
<select name="question_one" id="question_one">
<option value="">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_one.csv' ); ?>
</select>
</td>
</tr>
<tr>
<td>
How do you want to add colour/design to your controller?
<br />
<select name="question_two" id="question_two">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_two.csv' ); ?>
</select>
</td>
</tr>
<tr>
<td>
What design/colour would you like your controller to have?
<br />
<select name="question_three" id="question_three">
<option value="" selected="selected">- Please select -</option>
</select>
</td>
</tr>
<?php if ($this->show_question_four) : ?>
<tr>
<td>
What colour would you like the A, B, X and Y buttons?
<br />
<select name="question_four" id="question_four">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_four.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<?php if ($this->show_question_five) : ?>
<tr>
<td>
What appearance do you wish your guide button to have?
<br />
<select name="question_five" id="question_five">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_five.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<?php if ($this->show_question_six) : ?>
<tr>
<td>
Please select a colour for the four LEDs around the guide button.
<br />
<select name="question_six" id="question_six">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_six.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<?php if ($this->show_question_seven) : ?>
<tr>
<td>
What colour do you wish the thumbsticks to be?
<br />
<select name="question_seven" id="question_seven">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_seven.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<?php if ($this->show_question_eight) : ?>
<tr>
<td>
What colour do you want the D-Pad to be?
<br />
<select name="question_eight" id="question_eight">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_eight.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<?php if ($this->show_question_nine) : ?>
<tr>
<td>
If any, what package of MODs would you like installed?
<br />
<select name="question_nine" id="question_nine">
<option value="" selected="selected">- Please select -</option>
<?php echo $this->readCSV( $this->controllerDir . 'csv/question_nine.csv' ); ?>
</select>
</td>
</tr>
<?php endif; ?>
<tr>
<td>Current Controller Price
<br />
<input type="text" readonly="readonly" id="amount" name="amount" value="0.00"><?php echo $this->currency; ?>
</td>
</tr>
<tr>
<td>
Shipping <b>UK Only</b> (Special Next-Day Delivery by 1pm)
<br />
<input type="text" readonly="readonly" id="shipping" name="shipping" value="<?php echo $this->shipping; ?>"><?php echo $this->currency; ?>
</td>
</tr>
<tr>
<td><b>Total</b> <i>(Current Price + Shipping)</i>
<br />
<input type="text" readonly="readonly" id="total" name="total" value="0.00"><?php echo $this->currency; ?>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="myemail@somewhere.com">
<input type="hidden" name="lc" value="UK">
<input type="hidden" id="item_name" name="item_name" value="Controller">
<!--<input type="hidden" id="amount" name="amount" value="0.00">-->
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<!--<input type="hidden" id="shipping" name="shipping" value="0.00">-->
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="hidden" name="os0" value ="here's a bit of a description">
<hr size="1"/>
<input type="submit" id="submit" value="Purchase Now !" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" >
</td>
</tr>
</table>
<!--<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">-->
</form>
<div id="dialog-message" title="Please select an option" style="display:none">
<p style="padding-top:10px"></p>
</div>
<div id="loader"></div>
<script>
function ShowMessage( msg ) {
$( "#dialog-message p" ).text(msg);
$( "#dialog-message" ).dialog({modal: true, width: 350, buttons: {OK: function() {$( this ).dialog( "close" );}}});
}
</script>
</div>
<?php
}
}
?>
What you could do is have your form submit to a PHP script, and then that PHP script saves your order information to a database, sends to you via email etc. Once the script’s done that, you can simply redirect to PayPal with the order amount. An example:
You’ll need to flesh out the bits where you calculate the price, and saving to the database and/or sending the order details via email, but should be enough to get you going. It’s mainly to demonstrate how to redirect to PayPal in your PHP script.