Jump to content

chen2424

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chen2424's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. guys, surely someone here can help me out? thanks in advance,
  2. Hi Guys, im using chrome and ff and it worked fine till i tested on ie7 and the form just wont send on ie7. it gives me a validation error msg "SOME VALUES ARE NOT ACCEPTABLE" when i try to submit. ive tried so many things and i cant figure out why ie7 wont send upon submit like ff does, code seems to be fine, pls see validation coding line 7 - 32 , any phpGURU advice will be much appreciated! thanks for helping! <?php defined('_JEXEC') or die('Restricted access'); ?> <?php JHTML::_('behavior.formvalidation'); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // do field validation if (document.getElementById('jformfirstname').value == ""){ alert( "<?php echo JText::_( 'Firstname is missing.', true ); ?>" ); } else if (document.getElementById('jformsurname').value == ""){ alert( "<?php echo JText::_( 'Surname is missing.', true ); ?>" ); } else if (document.getElementById('jformemail').value == ""){ alert( "<?php echo JText::_( 'Email is missing.', true ); ?>" ); } else if (document.getElementById('jformphone1').value == ""){ alert( "<?php echo JText::_( 'Phone1 is missing.', true ); ?>" ); } else { if (document.formvalidator.isValid(form)) { submitform( pressbutton ); } else { alert("<?php echo JText::_( 'SOME VALUES ARE NOT ACCEPTABLE.', true ); ?>"); } } } </script> <?php if ($this->courseid){ ?> <?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?> <div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo $this->courseDetails->title; ?> </div> <?php endif; ?> <h3>Course Details</h3> <table cellSpacing=0 cellPadding=5 width="90%" border=0> <tr> <td width="20%"><?php echo JText::_( 'Course Title' ); ?>:</td> <td width="30%"><?php echo $this->courseDetails->title;?></td> <td width="20%"><?php echo JText::_( 'Code' ); ?>:</td> <td width="30%"><?php echo $this->courseDetails->code;?></td> </tr> <tr> <td><?php echo JText::_( 'Price' ); ?>:</td> <td><?php echo (number_format($this->courseDetails->price,2));?></td> <td><?php echo JText::_( 'No. of Days' ); ?>:</td> <td><?php echo $this->courseDetails->capacity;?></td> </tr> <tr> <?php if ($_GET['hide'] != 1 ) { ?> <td><?php echo JText::_( 'Location' ); ?>:</td> <td><?php echo $this->courseDetails->course_location;?></td> <?php } else { echo "<td> </td>"; echo "<td> </td>"; } ?> </tr> <tr> <?php if ($_GET['hide'] != 1 ) { ?> <td><?php echo JText::_( 'Start Date' ); ?>:</td> <td><?php echo Date('d-M-y', strtotime($this->courseDetails->start_date));?></td> <?php } else { echo "<td> </td>"; echo "<td> </td>"; } ?> </tr> </table> <?php } ?> <?php if ( $this->params->def( 'show_course_sessions', 1 ) && ($this->courseid) ) : ?> <h3>Sessions</h3> <table cellSpacing=0 cellPadding=5 width="90%" border=0> <tr> <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo JText::_('Day'); ?> </td> <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo JText::_('Start Time'); ?> </td> <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo JText::_('Finish Time'); ?> </td> <td width="10%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo JText::_('Duration'); ?> </td> <td width="30%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo JText::_('Location'); ?> </td> </tr> <?php $k = 0; $n=count( $this->course_sessions ); if ($n > 0){ for ($i=0, $n; $i < $n; $i++) { $row = &$this->course_sessions[$i]; ?> <tr> <td align="center"> <?php echo $row->session_day;?> </td> <td align="center"> <?php echo date('H:i', strtotime($row->start_time));?> </td> <td align="center"> <?php echo date('H:i', strtotime($row->finish_time));?> </td> <td align="center"> <?php echo $row->duration;?> </td> <td align="center"> <?php echo $row->session_location;?> </td> </tr> <?php $k = 1 - $k; } } else { ?> <tr> <td colspan="5"><? echo JText::_( 'There are no sessions for this course' );?></td></tr><?php } ?> </table> <?php endif; ?> <form action="<?php echo $this->action ?>" method="post" name="adminForm" id="adminForm" class="form-validate"> <?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?> <div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div> <?php endif; ?> <table cellpadding="4" cellspacing="1" border="0" width="100%"> <tr> <td width="15%"> <label for="jformcourseid"> <?php echo JText::_( 'Course' ); ?>: </label> </td> <td> <?php echo $this->lists['courseid'];?>* </td> </tr> <?php if ($_GET['hide'] == 1 ) { ?> <tr> <td valign="top"> <label for="jformcity"> <?php echo JText::_( 'I want to attend this course here' ); ?>: </label> </td> <td width="80%"> <select class="required" type="text" id="jformcountry" name="jform[country]" value="<?php echo $this->escape($this->booking->country);?>" />* <option>Choose your Location</option> <option>Melbourne</option> <option>Sydney</option> <option>Auckland</option> </select> </td> </tr> <?php } ?> <tr> <td valign="top"> <label for="jformfirstname"> <?php echo JText::_( 'Firstname' ); ?>: </label> </td> <td width="80%"> <input class="required" type="text" id="jformfirstname" name="jform[firstname]" size="50" maxlength="250" value="<?php echo $this->escape($this->booking->firstname);?>" />* </td> </tr> <tr> <td valign="top"> <label for="jformsurname"> <?php echo JText::_( 'Surname' ); ?>: </label> </td> <td valign="top"> <input class="required" type="text" id="jformsurname" name="jform[surname]" size="50" maxlength="250" value="<?php echo $this->escape($this->booking->surname);?>" />* </td> </tr> <?php if($this->userid > 0) { ?> <tr> <td valign="top"> <label for="jformusername"> <?php echo JText::_( 'Username' ); ?>: </label> </td> <td width="80%"> <input class="required" type="text" id="jformusername" name="jform[username]" size="50" maxlength="100" value="<?php echo $this->escape($this->username);?>" READONLY/>* </td> </tr> <?php } ?> <tr> <td valign="top"> <label for="jformdepartment"> <?php echo JText::_( 'Company' ); ?>: </label> </td> <td width="80%"> <input class="inputbox" type="text" id="jformdepartment" name="jform[department]" size="50" maxlength="30" value="<?php echo $this->escape($this->booking->department);?>" /> </td> </tr> <tr> <td valign="top"> <label for="jformemail"> <?php echo JText::_( 'Email' ); ?>: </label> </td> <td width="80%"> <input class="validate-email" type="text" id="jformemail" name="jform[email]" size="50" maxlength="100" value="<?php echo $this->escape($this->email);?>"/>* </td> </tr> <tr> <td valign="top"> <label for="jformphone1"> <?php echo JText::_( 'Phone Number' ); ?>: </label> </td> <td width="80%"> <input class="required" type="text" id="jformphone1" name="jform[phone1]" size="50" maxlength="20" value="<?php echo $this->escape($this->booking->phone1);?>" />* </td> </tr> <tr> <td valign="top"> <label for="jformcity"> <?php echo JText::_( 'Locations' ); ?>: </label> </td> <td width="80%"> <select type="text" id="jformcity" name="jform[city]" value="<?php echo $this->escape($this->booking->city);?>" /> <option>Choose your Location</option> <option>Melbourne</option> <option>Sydney</option> <option>Auckland</option> </select> </td> </tr> <tr> <td valign="top"> <label for="jforminstitution"> <?php echo JText::_( 'Referral Source' ); ?>: </label> </td> <td width="80%"> <select type="text" id="jforminstitution" name="jform[institution]" value="<?php echo $this->escape($this->booking->institution);?>" /> <option>How did you find out about us?</option> <option>Search Engine</option> <option>Friends</option> <option>Others</option> </select> </td> </tr> <tr> <td valign="top"> <label for="jformdescription"> <?php echo JText::_( 'Comments' ); ?>: </label> </td> <td> <textarea class="inputbox" cols="47" rows="6" id="jformdescription" name="jform[description]"><?php echo $this->escape( $this->booking->description);?></textarea> </td> </tr> </table> <div> <button type="button" class="button validate" onclick="submitbutton('save')"> <?php echo JText::_('Save') ?> </button> <button type="button" onclick="submitbutton('cancel')"> <?php echo JText::_('Cancel') ?> </button> </div> <input type="hidden" name="jform[id]" value="<?php echo $this->booking->id; ?>" /> <input type="hidden" name="jform[ordering]" value="<?php echo $this->booking->ordering; ?>" /> <input type="hidden" name="jform[approved]" value="<?php echo $this->booking->approved; ?>" /> <input type="hidden" name="jform[userid]" value="<?php echo $this->userid; ?>" /> <input type="hidden" name="option" value="com_courseman" /> <input type="hidden" name="controller" value="booking" /> <input type="hidden" name="task" value="" /> <?php echo JHTML::_( 'form.token' ); ?> </form> </br> Fields marked with an asterisk (*) are required. </br> </br>
  3. hi guys, ive got my form as below, dont mind the long options, just see that its now sending to 1 address. I want it such that if user choose from location dropdown, it will go to a diff email. eg, asia@domain.com for ASIA. america@domain.com ofr america etcetc. ps:i stripped out alot of unwanted parts of the form so my post wont be so long. Any ideas very much appreciated! <?php //If the form is submitted if(isset($_POST['submit'])) { include_once("connects.php"); $lname=trim($_POST['lname']); $bustitle=trim($_POST['bustitle']); $company=trim($_POST['company']); $Location=$_POST['Location']; $vendor=trim($_POST['category']); $course=trim($_POST['subcategory']); $coLoc=$_POST['courseLoc']; $find=trim($_POST['find']); //Check to make sure that the name field is not empty if(trim($_POST['fname']) == '') { $hasError = true; } else { $fname = trim($_POST['fname']); } //Check to make sure that the subject field is not empty if(trim($_POST['phone']) == '') { $hasError = true; } else { $phone = trim($_POST['phone']); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) == '') { $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $hasError = true; } else { $email = trim($_POST['email']); } //Check to make sure comments were entered if(trim($_POST['comments']) == '') { $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['comments'])); } else { $comments = trim($_POST['comments']); } } $linkdate=date("Y-m-d", time()); //If there is no error, send the email if(!isset($hasError)) { $emailTo = 'myemail@mydomain.com'; //Put your own email address here $subject = "Registration"; $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $bodyuser = "Dear $fname,\n Thank you for your registration. We will get back to you as soon as possible \n\n\n \n"; $subjectuser = "Registration - Message Received"; $headersuser = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($email, $subjectuser, $bodyuser, $headersuser); $emailSent = true; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <link href="css/style_sheet.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script src="Scripts/jquery.validate.pack.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $("#formname").validate(); }); </script> <body > <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="formname" name="formname"> <table border="0" cellpadding="0" cellspacing="0" width="940" height="100%"> <tr> <td width="940" colspan="2" height="10" bgcolor="#ffffff"> </td> </tr> <tr> <td width="940" colspan="2" height="1"> </td> </tr> <!-- Header banner --> <!--hearder end--> <tr> <td width="940" height="18" colspan="2"> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <!--content starts--> <td width="99%" valign="top" bgcolor="#FFFFFF" colspan=2> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="15"><img src="images/spacer.gif" alt="" width="15" height="1" border="0"></td> <td valign="top" align="left"> <!-- Content starts --> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="content"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="content"><?php if(isset($hasError)) { //If errors are found ?> <p class="error">Please check if you've filled all the fields with valid information. Thank you.</p> <?php } ?> <?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?> <p><strong>Email Successfully Sent!</strong></p> <p>Thank you <strong><?php echo $name;?></strong> for your registration. Your email was successfully sent and we will be in touch with you soon.</p> <?php } ?> </td> <td width="5"><img src="images/spacer.gif" alt="" width="5" height="1" border="0"></td> </tr> <tr> <td align="left" valign="top" class="con_pad"> <div id="ctl00_ContentPlaceHolder2_ctl02_formReg2"> <table width="50%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2%" class="con_pad1"> </td> <td width="32%" class="content">First name <br><br></td> <td width="2%" class="content">:<br><br></td> <td width="64%" class="content con_pad1"><table border="0" cellpadding="0" cellspacing="0"> <tr><td width="4" align="left"><img src="images/red_strip_frm.gif" alt="Mandatory field" align="absbottom"><br><br></td><td><input name="fname" type="text" maxlength="50" id="fname" class="required" style="width:200px;" /><br><br></td></tr></table></td></tr> <tr> <td class="con_pad1"> </td> <td class="content">Location<br><br></td> <td class="content"> </td> <td class="content con_pad1"><img src="images/red_strip_frm.gif" alt="Mandatory field" height="18" align="absbottom" /> <select name="courseLoc" id="courseLoc" class="required" > <option value="" selected="selected">--Select--</option> <option value="asia">asia</option> <option value="america">america</option> <option value="europe">europe</option> </select><br><br></td> </tr> <tr> <td width="2%" valign="top" class="con_pad1"> </td> <td width="32%" valign="top" class="content con_pad1">Comments </td> <td width="2%" valign="top" class="content con_pad1">:</td> <td width="64%" align="left" valign="top" class="con_pad1"><table border="0" cellpadding="0" cellspacing="0"> <tr><td width="4" align="left" valign="top"><img src="images/red_strip_frm_tarea.gif" alt="Mandatory field" align="absbottom"></td> <td><textarea name="comments" rows="3" cols="20" id="comments" class="required" style="width:200px;"></textarea></td></tr></table> <br /><br /></td> </tr> </table> </div></td> <td> </td> </tr> <tr><td colspan="4" align="center"><input type="submit" name="submit" value="Submit" id="submit" title="Submit" style="height:25px;width:70px;cursor:pointer;" /> </td></tr> </table> <!-- start more info --></td></tr> <!-- end more info --> </table> </td> </tr> </table> <!-- Content ends here --> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!--footer start--> <!--footer end--> </table> <div> </div></form> </body> </html>
  4. hi guys, I have 1 table jos_abc and i want to pull 2 fields tt reside in this table into my form in 2 dropdowns. 1 is brand and 1 is flavour. So if brand is dropdown and benjerrys is selected, flavour dropdown will show flavours only for benjerrys. kind of like this http://www.whatcar.com/ but i dont need the ajax. js is fine. this is what i have so far, hw do i write rest of code? any insight pls, <?php if(isset($_POST['action'])) { // handle submitted form data // then redirect } ?> <html> <head> <title></title> </head> <body> <form method="post" action="<?=( $_SERVER['PHP_SELF'] )?>"> <select name="title" onchange="this.form.submit();"> <option value=""> -- Select --</option> <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); $sql = 'SELECT id , brand FROM jos_icecream ORDER BY brand'; $result = mysql_query($sql); ?> </select><noscript> <input type="submit" value=" Refresh " /></noscript> <input type="submit" name="action" value=" Submit " /> </form> </body> </html>
  5. the error is that on create_account.php the continue button doesnt work. Basically the code ive posted above causes that conflict so i was asking if there was errors in that code i posted,
  6. Hi Guys, this code seems to work in my osc header.php but it causes a slight conflict with another register function. Ive streamlined problem to be in this peice code, probably the if else part, can someone help out here pls, my php is far fm brilliant , but im trying man.... thanks in advance! <table> <?php if (tep_session_is_registered('customer_id')) {?> <a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo tep_image(DIR_WS_IMAGES . 'buttonlogout.jpg', HEADER_TITLE_LOGOFF); ?></a> <a href="account_history.php"><img border="0" src="images/orderhistory.png"></a> <tr><td><?php }else{ echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'));?></td></tr> <tr><td>Email :<?php echo tep_draw_input_field('email_address');?></td></tr> <tr><td>Password:<?php echo tep_draw_password_field('password');?></td></tr> <tr><td><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); } ?></td></tr> </table> kind regards, Chen
  7. Hi Cbolson. thanks for yr reply , ive tried that,. : <form> Select a User: <select name="users" onload="showUser(1)" onchange="showUser(this.value)"> <option selected value="1">Peter Griffin</option> This doesnt solve the issue, peter still doesnt load on page load strangely,. any ideas why? Thanks in advance!
  8. Hi guys, ive used the this ajax db code tutorial from http://www.w3schools.com/php/php_ajax_database.asp and it works well. Problem is this, in the example, assuming we put <option selected value="1">Peter Griffin</option> , how do we get the page to load peter griffins data automatically? If you observe when you enter the page, peter griffin is shown but not loaded. Youll have to select something else and go back to reselect peter grifin in order to load data. How can we autoload this on page load or refresh? Many thanks in adv to anyone who knows. kind rgds, Chen
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.