Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP order form & total

Featured Replies

Hey guys,

 

Im working on a friends web design site, he has a form where the user enters their name, email, selects what they want to order, if they want any additional pages and an additional comments text area.

 

Ive managed to set it up so an email is sent to him and the person who fills the form out but I want it to calculate the total price of the order before you submit it, but I have no idea how to go about it cus the email script is pretty complicated already. I used a generator for the form and changed it for what I needed it to do so it could definitely be simplified.

 

If someone could give me some direction id appreciate it, I like to do design but not development.

 

Thanks

  • Author

Ok then, I have 2 files but like I say, to someone who knows a bit more about PHP could probably make it work in about 20 lines rather then two long files.

 

services.php

<?php

# This block must be placed at the very top of page.
# --------------------------------------------------
require_once( dirname(__FILE__).'/form.lib.php' );
phpfmg_display_form();
# --------------------------------------------------



function phpfmg_form( $sErr = false ){
	$style=" class='form_text' ";

?>

<form name="frmFormMail" action='' method='post' enctype='multipart/form-data' onsubmit='return fmgHandler.onsubmit();'>
<input type='hidden' name='formmail_submit' value='Y'>
<div id='err_required' class="form_error" style='display:none;'>
   <label class='form_error_title'>Please check the required fields</label>
</div>


<ol class='phpfmg_form' >

<li class='field_block' id='field_0_div'><div class='col_label'>
<label class='form_field'>Name:</label> <label class='form_required' ></label> </div>
<div class='col_field'>
<input type="text" name="field_0"  id="field_0" value="<?php  phpfmg_hsc("field_0"); ?>" class='text_box'>
<div id='field_0_tip' class='instruction'></div>
</div>
</li>
<br />
<li class='field_block' id='field_1_div'><div class='col_label'>
<label class='form_field'>Email Address:</label> <label class='form_required' ></label> </div>
<div class='col_field'>
<input type="text" name="field_1"  id="field_1" value="<?php  phpfmg_hsc("field_1"); ?>" class='text_box'>
<div id='field_1_tip' class='instruction'></div>
</div>
</li>
<br />
<li class='field_block' id='field_2_div'><div class='col_label' id="sprytrigger5">
<label class='form_field'>Order:</label> <label class='form_required' ></label> </div>
<div class='col_field'>
<?php phpfmg_checkboxes( 'field_2', "Basic 5-page website|jQuery/JavaScript elements|Video creation" );?>
<div id='field_2_tip' class='instruction'></div>
</div>
</li>
<br />
<li class='field_block' id='field_3_div'><div class='col_label'>
<label class='form_field'>Additional Pages:</label> <label class='form_required' ></label> </div>
<div class='col_field'>
<input type="text" name="field_3"  id="field_3" value="<?php  phpfmg_hsc("field_3"); ?>" class='text_box'>
<div id='field_3_tip' class='instruction'></div>
</div>
</li>
<br />
<li class='field_block' id='field_4_div'><div class='col_label'>
<label class='form_field'>Additional Information:</label> <label class='form_required' ></label> </div>
<div class='col_field'>
<textarea style="font-family: Georgia, 'Times New Roman', serif" name="field_4" id="field_4" rows=4 cols=25 class='text_area'><?php  phpfmg_hsc("field_4"); ?></textarea>

<div id='field_4_tip' class='instruction'></div>
</div>
</li>


           <div class='col_label'> </div>
           <div class='form_submit_block col_field'>

               <input type='submit' value='Submit' class='form_button'>
               <span id='phpfmg_processing' style='display:none;'>
                   <img id='phpfmg_processing_gif' src='<?php echo PHPFMG_ADMIN_URL . '?mod=image&func=processing' ;?>' border=0 alt='Processing...'> <label id='phpfmg_processing_dots'></label>
               </span>
           </div>

</ol>




</form>

 

There is also form.lib.php but its so long I didnt wanna post it, theres also a bit after the closing form tag but its CSS so I didnt bother posting that.

I wouldn't recommend using a generator to generate the form code.

 

Not including the HTML code for the actual form, you could probably do what it is that you want in about 100 lines of code, and that's giving a bit of room here and there.

 

The code that you just posted is just a function that outputs the code required for the browser to display the form. By the sounds of it, form.lib.php is the php file that rallport was actually referring to and it may be best to post that somewhere like http://pastebin.com and post a link. :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.