Jump to content

Merdok

Members
  • Posts

    126
  • Joined

  • Last visited

    Never

About Merdok

  • Birthday 12/02/1981

Contact Methods

  • Website URL
    http://www.digitalfusionmag.com

Profile Information

  • Gender
    Male
  • Location
    Yorkshire, UK

Merdok's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks man! That worked perfectly
  2. Thank you for the advice, I had no idea it was outdated Sadly it did not work though, here is the code for the entire page just in case the problem is located elsewhere: <?php //tells the menu which module this is $current_module = 2; require_once('../../templates/standard/socket_header.php'); ?> <p class="float_right button"> <a href="<?php echo $siteroot?>/socket/index.php">Discard</a></p><h1>Article Editor</h1> <p>From here you can edit your blog articles.</p> <?php if($_GET['ID']) { // Pulls the data from the database $dblookup = "SELECT * FROM core_pages WHERE articleID=" . $_GET['ID']; $data = mysql_query($dblookup) or die('Failed to return data: ' . mysql_error()); /* sorts the data into variables and puts them in an array ready to be called when needed */ $dataarray = mysql_fetch_array($data, MYSQL_BOTH); extract($dataarray, EXTR_PREFIX_ALL, "bl"); } elseif (!empty($_POST['submit'])) // If the updates have been submitted { // Save previous article to the revisions table $saveArticle = mysql_query("SELECT * FROM core_pages WHERE articleID =" . $_POST['articleID']) or die ('No articles found'); $savedArticles = mysql_fetch_array($saveArticle, MYSQL_BOTH); extract($savedArticles, EXTR_PREFIX_ALL, "saved"); $currentUser = $_SESSION['userID']; $dbinsert = mysql_query("INSERT INTO core_pages_revisions (articleID, articleTitle,articleKeywords,articleDesc, permaLink, articleBody, allowCustomFooter, customFooter, chooseBackground, customBackground, articlePosted, parent) VALUES ('$saved_articleID', '".addslashes($saved_articleTitle)."', '".addslashes($saved_articleKeywords)."', '".addslashes($saved_articleDesc)."', '".addslashes($saved_permaLink)."', '".addslashes($saved_articleBody)."', '".addslashes($saved_allowCustomFooter)."','".addslashes($saved_customFooter)."','".addslashes($saved_chooseBackground)."','".addslashes($saved_customBackground)."', '".addslashes($saved_articlePosted)."', '".addslashes($saved_parent)."')") or die ('insertion failed: ' . mysql_error()); // Now insert the updates into the live database $articleID = $_POST['articleID']; $parent = $_POST['parent']; $articleTitleDirty = str_replace("...","",$_POST['articleTitle']); $articleDescDirty = $_POST['articleDesc']; $articleKeywordsDirty= $_POST['articleKeywords']; $articleTitle = htmlentities(addslashes($articleTitleDirty)); $articleDesc = htmlentities(addslashes($articleDescDirty)); $articleKeywords = htmlentities(addslashes($articleKeywordsDirty)); $permaLinkDirty = str_replace(" ","-",$_POST['articleTitle']); $permaLinkDashed = strtolower(preg_replace('/[^A-Za-z0-9-]/','',$permaLinkDirty)); $permaLink = str_replace("---","-",$permaLinkDashed); $articleBody = addslashes($_POST['articleBody']); $allowCustomFooter = addslashes($_POST['allowCustomFooter']); $customFooter = addslashes($_POST['customFooter']); $chooseBackground = addslashes($_POST['chooseBackground']); // Handles file uploading if (isset($_POST['customBackground']) && $_FILES['customBackground']['error'] == UPLOAD_ERR_OK) { $path1= '/upload/' . date('U'). $_FILES['customBackground']['name']; if(empty($path1)) { $message = '<p class="red size10font">Background field cannot be blank!</p>';} else { //copy file to where you want to store file copy($_FILES['customBackground']['tmp_name'], $path1); } } if ($_POST['submit'] == 'Publish Page' || $saved_articlePosted ==1) {$articlePosted = 1;} // Updates the database $dbupdate = "UPDATE core_pages "; $dbupdate .= "SET articleTitle = '$articleTitle', articleDesc = '$articleDesc', articleKeywords = '$articleKeywords', permaLink = '$permaLink', articleBody = '$articleBody',"; if ($allowCustomFooter == 1) { $dbupdate .= " allowCustomFooter = '$allowCustomFooter', customFooter = '$customFooter',"; } if ($chooseBackground == 1) { $dbupdate .= " chooseBackground = '$chooseBackground', customBackground = '$path1',"; } $dbupdate .= " parent = '$parent', articlePosted = '$articlePosted'"; $dbupdate .= " WHERE articleID = '$articleID'"; $posted = mysql_query($dbupdate) or die('<h3 class="error"> Update Failed! </h3>' . mysql_error()); if ($posted) { $message = '<div class="success"><p><strong>Success!</strong> Your article has been modifed</p></div>'; ?> <!-- javascript send message to menu --> <script language="JavaScript"> window.location.href = '<?php echo $socketroot ?>/modules/pages/admin.php?message=' + <?php echo $message; ?>; </script> <?php }} ?> <h2> <?php echo "Curently Editing: " . html_entity_decode(stripslashes($bl_articleTitle));?></h2> <form enctype="multipart/form-data" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post"> <input name="articleID" type="hidden" id="articleID" value="<?php echo $bl_articleID; ?>"> <p> <label>Full Title<br /> <input name="articleTitle" type="text" id="articleTitle" size="70" value="<?php echo html_entity_decode(stripslashes($bl_articleTitle)) ?>"> </label> </p> <p> <label>Body Text<br /> <textarea class="mceAdvanced" name="articleBody" id="articleBody" cols="75" rows="35"><?php echo stripslashes($bl_articleBody) ?></textarea> </label> </p> <p> <label>Keywords (comma seperated)<br /> <textarea class="noMCE" name="articleKeywords" id="articleKeywords" cols="81" rows="8"><?php echo stripslashes($bl_articleKeywords) ?></textarea> </label> </p> <p> <label>Description<br /> <textarea class="noMCE" name="articleDesc" id="articleDesc" cols="81" rows="8"><?php echo stripslashes($bl_articleDesc) ?></textarea> </label> </p> <div class="inputcontainer"> <label class="tab" for="articleCat">Select Parent <select class="intab" name="parent"> <?php $lookupParents = "SELECT permaLink, articleTitle FROM core_pages WHERE parent = 0"; $parents = mysql_query($lookupParents) or die('Failed to return data: ' . mysql_error()); /* sorts the data into variables and puts them in an array ready to be called when needed */ echo '<option value="'.$bl_parent.'" selected="selected"> Don\'t change parent </option>'; if ($bl_parent != 0) { echo '<option value="0"> Promote page to parent </option>'; } while($option = mysql_fetch_array($parents)) { echo '<option value="' . $option['permaLink']; echo '">' .$option['articleTitle'].'</option>'; } ?> </select></label> </div> <div class="inputcontainer"> <label class="tab" for="allowCustomFooter">Footer Options <select onchange="if( $(this).val() == 1 ) { $('.customFooterContainer').show() } else { $('.customFooterContainer').hide() }" name="allowCustomFooter" id="allowCustomFooter"> <option value="0">Default Footer</option> <option value="1">Use custom Footer</option> </select> </label> </div> <div class="inputcontainer customFooterContainer"> <textarea class="mceAdvanced" name="customFooter" id="customFooter" cols="75" rows="35"></textarea> </div> <div class="inputcontainer"> <label class="tab" for="chooseBackground">Background Options <select onchange="if( $(this).val() == 1 ) { $('.customBackgroundContainer').show() } else { $('.customBackgroundContainer').hide() }" name="chooseBackground" id="chooseBackground"> <option value="0">Default Background</option> <option value="1">Use custom Background</option> </select> </label> </div> <div class="inputcontainer customBackgroundContainer"> <label class="tab" for="articleTitle">Choose custom background</label> <input class="fullwidth biggun" name="customBackground" type="file" id="customBackground" size="70" value=""> </div> <?php if ($bl_articlePosted != 1) { ?> <input name="submit" type="submit" value="Publish Page"> <?php } ?> <input name="submit" type="submit" value="Save Changes"> </form> <?php require_once('../../templates/standard/socket_footer.php'); ?>
  3. Hi Guys, I found this upload script a while ago and I'm sure the last time I used it, it worked perfectly but for some reason '$path1' keeps returning as blank. I'm not very good with file uploads, can anyone help me out please? if ($_POST['customBackground']) { $path1= '/upload/' . date(U). $HTTP_POST_FILES['customBackground']['name'][0]; if(empty($path1)) { $message = '<p class="red size10font">Background field cannot be blank!</p>';} else { //copy file to where you want to store file copy($HTTP_POST_FILES['customBackground']['tmp_name'][0], $path1); } } The field it is being populated from is <input class="fullwidth biggun" name="customBackground" type="file" id="customBackground" size="70" value=""> Thank you in advance.
  4. Oh God I can't believe it was that! I knew that too, I MUST have been tired, yeah the indenting is terrible, I wrote the CMS the form comes from a long time ago, it's horrible code now, I need to rewrite it really to be object oriented Thanks for noticing my idiocy, works like a charm now
  5. Hi Guys, I have built a contact form recently and with help from you guys I managed to add a file upload facility to it, however I am now stuck on something else. The form validation that I have written is always showing the form as not valid when it should be. I'm not sure if it is related to the javascript I have attached to the fields, I have never combined the two things this way before and I am not sure how to fix it. I would be most appreciative of any help you can give me. Here is my code: <?php // BEGIN SOCKET IMPLEMENTATION require_once($_SERVER['DOCUMENT_ROOT'] . '/socket/globals.php'); //Sets the static pageID if ($_GET['article']) { if ($_GET['revision']) { // If viewing a revision from SOCKET $dblookup = "SELECT articleID, datePosted, articleTitle, permaLink, articleBody, sideBody, parent FROM core_pages_revisions WHERE(revisionID ='".$_GET['revision']."') LIMIT 1"; } else { $dblookup = "SELECT articleID, datePosted, articleTitle, permaLink, articleBody, sideBody, parent FROM core_pages WHERE(articleID ='".$_GET['article']."') OR (permaLink ='".$_GET['article']."'"; if($_GET['parent']) { $dblookup .= " AND parent ='".$_GET['parent']."'"; } $dblookup .= ") LIMIT 1"; } $data = mysql_query($dblookup) or die('Failed to return data: ' . mysql_error()); if (mysql_num_rows($data) == 0) { redirect_to('/404');exit;} /* sorts the data into variables and puts them in an array ready to be called when needed */ while(list($articleID, $datePosted, $articleTitle, $permaLink, $articleBody, $sideBody, $parent) = mysql_fetch_array($data, MYSQL_BOTH)) { $meta_title = html_entity_decode(stripslashes("$articleTitle")); $module_ID = 2; $theH1 = '<h1>' . stripslashes(html_entity_decode($articleTitle)) . '</h1>'; $theParent = $parent; $parentUrl = $_SERVER['HTTP_REFERER']; require_once('' . $serverroot . '/style/standard/head.php'); require_once('' . $serverroot . '/style/standard/head2.php'); require_once('style/standard/header.php'); if(isset($_POST['submit'])) { // form validation if($_POST['first_name'] == 'First Name'||$_POST['last_name'] == 'Last Name'||$_POST['your_company'] == 'Company'||$_POST['your_email'] == 'Email'||$_POST['your_telephone'] = 'Telephone') { $errors = "please ensure all mandatory fields are completed"; } else { /* Deals with file uploading */ if (($_FILES["ttt"]["size"] < 500000)) { if ($_FILES["ttt"]["error"] > 0) { echo "Return Code: " . $_FILES["ttt"]["error"] . "<br />"; } else { move_uploaded_file($_FILES["ttt"]["tmp_name"], "upload/" . $_FILES["ttt"]["name"]); $fileLink = $siteroot. "/upload/" . $_FILES["ttt"]["name"]; } } else { echo "Invalid file"; } $to = str_replace('info', 'sales', $sc_email); $subject = "Quotation request from website"; $body = "From: ".$_POST['first_name']." ".$_POST['last_name']."\n"; if ($_POST['job_title']) { $body .= "(".$_POST['job_title']." at ".$_POST['your_company'].")\n"; } $body .= "E-Mail: ".$_POST['your_email']."\n"; $body .= "Telephone: ".$_POST['your_telephone']."\n"; $body .= "Address:\n ".$_POST['your_address']." ,".$_POST['your_country']."\n\n"; $body .= "Project: ".$_POST['project_details']."\n"; $body .= "Translate to: ".$_POST['lang_target']." from ".$_POST['lang_source']."\n"; $body .= "by: ".$_POST['project_deadline']; $body .= "The text: ".$_POST['text_to_translate']; $body .= "Link to attachment: <a href=".$fileLink."> Link </a>"; } if (!$errors) { echo '<h1> Email Sent! </h1>'; echo '<p>Thank you for your enquiry.</p> <p>If it is required a representative will contact you as soon as possible</p><p><strong>Please note:</strong></p> <p>We endeavour to respond to all requests within ' . $sc_response_time . ' however during busy or holiday periods this may increase. </p>'; mail($to, $subject, $body); } else { echo $errors; } } //Main content starts here /****************************/ /* Page starts here */ /****************************/ //echo '<img class="hidden" src="'.$siteroot.'/Scripts/phpThumb/phpThumb.php?src='.$siteroot.'/Scripts/phpThumb/phpThumb.php?w=100&h=100&zc='.$articleImagePos.'&src='.$articleImage.'" />'; if ($_SESSION['access_lvl'] <= 1) { // if a user with appropriate access levels is logged in, allow them to edit this page // to add } echo stripslashes($articleBody); ?> <form id="quote_form" name="quote_form" enctype="multipart/form-data" method="post" action="<?php $_SERVER['SCRIPT_NAME']?>"> <fieldset> <legend> Your Details </legend> <table border="0" cellpadding="0" cellspacing="5"> <tr> <td class="colOne"> Name </td> <td class="colTwo"><label for="first_name">First Name</label> <input type="text" name="first_name" id="first_name" value="<?php if ($_POST['submit']) { echo $_POST['first_name']; } else { echo 'First Name'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='First Name'}" /></td> <td><label for="last_name">Last Name</label> <input type="text" name="last_name" id="last_name" value="<?php if ($_POST['submit']) { echo $_POST['last_name']; } else { echo 'Last Name'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Last Name'}" /></td> </tr> <tr> <td class="colOne"></td> <td class="colTwo"><label for="job_title">Job Title</label> <input type="text" name="job_title" id="job_title" value="<?php if ($_POST['submit']) { echo $_POST['job_title']; } else { echo 'Job Title'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Job Title'}"/></td> <td><label for="your_company">Company</label> <input type="text" name="your_company" id="your_company" value="<?php if ($_POST['submit']) { echo $_POST['your_company']; } else { echo 'Company'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Company'}"/></td> </tr> <tr> <td class="colOne"> Contact </td> <td class="colTwo"><label for="your_telephone">Telephone</label> <input type="text" name="your_telephone" id="your_telephone" value="<?php if ($_POST['submit']) { echo $_POST['your_telephone']; } else { echo 'Telephone'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Telephone'}" /></td> <td><label for="your_email">Email Address</label> <input type="text" name="your_email" id="your_email" value="<?php if ($_POST['submit']) { echo $_POST['your_email']; } else { echo 'Email'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Email'}"/></td> </tr> <tr> <td class="colOne"> Address </td> <td class="colTwo" valign="top"><label for="your_address">Address</label> <textarea name="your_address" id="your_address" cols="45" rows="5" ><?php echo $_POST['your_address']; ?></textarea></td> <td></td> </tr> <tr> <td class="colOne"> Country </td> <td class="colTwo"><label for="your_country">Country</label> <select name="your_country" id="your_country"> <option value="" <?php if (!$_POST['submit']) { echo 'selected="selected'; } ?>>Select your country</option> <?php $countries = mysql_query("SELECT * FROM custom_countries") or die ("Could not get countries list".mysql_error()); while($option = mysql_fetch_array($countries)) { if ($_POST['your_country'] == $option['country_name']) { $selected = 'selected="selected'; } echo '<option '.$selected.' value="' . $option['country_name'].'">' .$option['country_name'].'</option>'; } ?> </select></td> <td></td> </tr> </table> </fieldset> <fieldset> <legend> Your Quote </legend> <table border="0" cellpadding="0" cellspacing="5"> <tr> <td class="colOne"> Languages </td> <td class="colTwo"><label for="lang_source">Source Language</label> <select name="lang_source" id="lang_source"> <option value="" selected="selected">Translate from</option> <?php $languages = mysql_query("SELECT * FROM custom_languages") or die ("Could not get languages list".mysql_error()); while($option = mysql_fetch_array($languages)) { if ($_POST['lang_source'] == $option['language_name']) { $selected = 'selected="selected'; } echo '<option '.$selected.' value="' . $option['language_name'].'">' .$option['language_name'].'</option>'; } ?> </select> <label for="lang_target[]">Target Language</label></td> <td>(hold CTRL to select multiple languages)<select name="lang_target[]" size="6" multiple="multiple" id="lang_target[]"> <option value="" selected="selected">Translate to</option> <?php $languages = mysql_query("SELECT * FROM custom_languages") or die ("Could not get languages list".mysql_error()); while($option = mysql_fetch_array($languages)) { if ($_POST['lang_target'] == $option['language_name']) { $selected = 'selected="selected'; } echo '<option '.$selected.' value="' . $option['language_name'].'">' .$option['language_name'].'</option>'; } ?> </select></td> </tr> <tr> <td class="colOne"> Project</td> <td class="colTwo"><label for="project_details">Project Details</label> <input type="text" name="project_details" id="project_details" value="<?php if ($_POST['submit']) { echo $_POST['project_details']; } else { echo 'Reference'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Reference'}" /></td> <td><label for="project_deadline">Project Deadline</label> <input type="text" name="project_deadline" id="project_deadline" value="<?php if ($_POST['submit']) { echo $_POST['project_deadline']; } else { echo 'Deadline'; } ?>" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Deadline'}" /></td> </tr> <tr> <td class="colOne"> Text to translate</td> <td colspan="2"><label for="ttt">Text to translate</label> <input type="file" name="ttt" id="ttt" value="" /> </tr> <tr> <td> </td> <td><input class="form_button" type="submit" name="submit" id="submit" value="Submit" /><p class="red size10font"><?php echo $error ?></p></td> </tr> </table> </fieldset> </form> </div> <?php //Main content ends here require_once('style/standard/footer.php'); } } ?>
  6. Tsk... I knew that as well... that fixed it... thanks man
  7. Yes I believe base64 encoding was a part of the tutorial Here is the code for the full page: <?php // BEGIN SOCKET IMPLEMENTATION require_once($_SERVER['DOCUMENT_ROOT'] . '/socket/globals.php'); //Sets the static pageID if ($_GET['article']) { if ($_GET['revision']) { // If viewing a revision from SOCKET $dblookup = "SELECT articleID, datePosted, articleTitle, permaLink, articleBody, sideBody, parent FROM core_pages_revisions WHERE(revisionID ='".$_GET['revision']."') LIMIT 1"; } else { $dblookup = "SELECT articleID, datePosted, articleTitle, permaLink, articleBody, sideBody, parent FROM core_pages WHERE(articleID ='".$_GET['article']."') OR (permaLink ='".$_GET['article']."'"; if($_GET['parent']) { $dblookup .= " AND parent ='".$_GET['parent']."'"; } $dblookup .= ") LIMIT 1"; } $data = mysql_query($dblookup) or die('Failed to return data: ' . mysql_error()); if (mysql_num_rows($data) == 0) { redirect_to('/404');exit;} /* sorts the data into variables and puts them in an array ready to be called when needed */ while(list($articleID, $datePosted, $articleTitle, $permaLink, $articleBody, $sideBody, $parent) = mysql_fetch_array($data, MYSQL_BOTH)) { $meta_title = html_entity_decode(stripslashes("$articleTitle")); $module_ID = 2; $theH1 = '<h1>' . stripslashes(html_entity_decode($articleTitle)) . '</h1>'; $theParent = $parent; $parentUrl = $_SERVER['HTTP_REFERER']; require_once('' . $serverroot . '/style/standard/head.php'); require_once('' . $serverroot . '/style/standard/head2.php'); require_once('style/standard/header.php'); if(isset($_POST['submit'])) { /* Deals with file uploading */ if (($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); $fileLink = $siteroot. "/upload/" . $_FILES["file"]["name"]; } } else { echo "Invalid file"; } $to = str_replace('info', 'sales', $sc_email); $subject = "Quotation request from website"; $body = "From: ".$_POST['first_name']." ".$_POST['last_name']."\n"; if ($_POST['job_title']) { $body .= "(".$_POST['job_title']." at ".$_POST['your_company'].")\n"; } $body .= "E-Mail: ".$_POST['your_email']."\n"; $body .= "Telephone: ".$_POST['your_telephone']."\n"; $body .= "Address:\n ".$_POST['your_address']." ,".$_POST['your_country']."\n\n"; $body .= "Project: ".$_POST['project_details']."\n"; $body .= "Translate to: ".$_POST['lang_target']." from ".$_POST['lang_source']."\n"; $body .= "by: ".$_POST['project_deadline']; $body .= "The text: ".$_POST['text_to_translate']; $body .= "Link to attachment: <a href=".$fileLink."> Link </a>"; if ($errors) { echo $errors; } else { echo '<h1> Email Sent! </h1>'; echo '<p>Thank you for your enquiry.</p> <p>If it is required a representative will contact you as soon as possible</p><p><strong>Please note:</strong></p> <p>We endeavour to respond to all requests within ' . $sc_response_time . ' however during busy or holiday periods this may increase. </p>'; mail($to, $subject, $body); } } else { //Main content starts here /****************************/ /* Page starts here */ /****************************/ //echo '<img class="hidden" src="'.$siteroot.'/Scripts/phpThumb/phpThumb.php?src='.$siteroot.'/Scripts/phpThumb/phpThumb.php?w=100&h=100&zc='.$articleImagePos.'&src='.$articleImage.'" />'; if ($_SESSION['access_lvl'] <= 1) { // if a user with appropriate access levels is logged in, allow them to edit this page // to add } echo stripslashes($articleBody); ?> <form id="quote_form" name="quote_form" method="post" action="<?php $_SERVER['SCRIPT_NAME']?>"> <fieldset> <legend> Your Details </legend> <table border="0" cellpadding="0" cellspacing="5"> <tr> <td class="colOne"> Name </td> <td class="colTwo"><label for="first_name">First Name</label> <input type="text" name="first_name" id="first_name" value="First Name" onfocus="this.value=''" onblur="if (this.value = "") {this.value='First Name'}" /></td> <td><label for="last_name">Last Name</label> <input type="text" name="last_name" id="last_name" value="Last Name" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Last Name'}" /></td> </tr> <tr> <td class="colOne"></td> <td class="colTwo"><label for="job_title">Job Title</label> <input type="text" name="job_title" id="job_title" value="Job Title" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Job Title'}"/></td> <td><label for="your_company">Company</label> <input type="text" name="your_company" id="your_company" value="Company" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Company'}"/></td> </tr> <tr> <td class="colOne"> Contact </td> <td class="colTwo"><label for="your_telephone">Telephone</label> <input type="text" name="your_telephone" id="your_telephone" value="Telephone" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Telephone'}" /></td> <td><label for="your_email">Email Address</label> <input type="text" name="your_email" id="your_email" value="Email" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Email'}"/></td> </tr> <tr> <td class="colOne"> Address </td> <td class="colTwo" valign="top"><label for="your_address">Address</label> <textarea name="your_address" id="your_address" cols="45" rows="5" ></textarea></td> <td></td> </tr> <tr> <td class="colOne"> Country </td> <td class="colTwo"><label for="your_country">Country</label> <select name="your_country" id="your_country"> <option value="" selected="selected">Select your country</option> <?php $countries = mysql_query("SELECT * FROM custom_countries") or die ("Could not get countries list".mysql_error()); while($option = mysql_fetch_array($countries)) { echo '<option value="' . $option['country_name'].'">' .$option['country_name'].'</option>'; } ?> </select></td> <td></td> </tr> </table> </fieldset> <fieldset> <legend> Your Quote </legend> <table border="0" cellpadding="0" cellspacing="5"> <tr> <td class="colOne"> Languages </td> <td class="colTwo"><label for="lang_source">Source Language</label> <select name="lang_source" id="lang_source"> <option value="" selected="selected">Translate from</option> <?php $languages = mysql_query("SELECT * FROM custom_languages") or die ("Could not get languages list".mysql_error()); while($option = mysql_fetch_array($languages)) { echo '<option value="' . $option['language_name'].'">' .$option['language_name'].'</option>'; } ?> </select> <label for="lang_target[]">Target Language</label></td> <td>(hold CTRL to select multiple languages)<select name="lang_target[]" size="6" multiple="multiple" id="lang_target[]"> <option value="" selected="selected">Translate to</option> <?php $languages = mysql_query("SELECT * FROM custom_languages") or die ("Could not get languages list".mysql_error()); while($option = mysql_fetch_array($languages)) { echo '<option value="' . $option['language_name'].'">' .$option['language_name'].'</option>'; } ?> </select></td> </tr> <tr> <td class="colOne"> Project</td> <td class="colTwo"><label for="project_details">Project Details</label> <input type="text" name="project_details" id="project_details" value="Reference" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Reference'}" /></td> <td><label for="project_deadline">Project Deadline</label> <input type="text" name="project_deadline" id="project_deadline" value="Deadline" onfocus="this.value=''" onblur="if (this.value = "") {this.value='Deadline'}" /></td> </tr> <tr> <td class="colOne"> Text to translate</td> <td colspan="2"><label for="ttt">Text to translate</label> <input type="file" name="ttt" id="ttt" value="" /> </tr> <tr> <td> </td> <td><input class="form_button" type="submit" name="submit" id="submit" value="Submit" /><p class="red size10font"><?php echo $error ?></p></td> </tr> </table> </fieldset> </form> </div> <?php } //Main content ends here require_once('style/standard/footer.php'); } } ?>
  8. Hi Guys, I'm trying to build a form which includes a file field. The idea is that it will upload the file and then email it as an attachment, I couldnt' figure that out at all so I thought I'd go with uploading the file and including a link to it in the email, however that isn't working either and I don't understand why... i'm not getting any error messages and the upload folder is set to 777. if (($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); $fileLink = $siteroot. "/upload/" . $_FILES["file"]["name"]; } } else { echo "Invalid file"; } $to = str_replace('info', 'sales', $sc_email); $subject = "Quotation request from website"; $body = "From: ".$_POST['first_name']." ".$_POST['last_name']."\n"; if ($_POST['job_title']) { $body .= "(".$_POST['job_title']." at ".$_POST['your_company'].")\n"; } $body .= "E-Mail: ".$_POST['your_email']."\n"; $body .= "Telephone: ".$_POST['your_telephone']."\n"; $body .= "Address:\n ".$_POST['your_address']." ,".$_POST['your_country']."\n\n"; $body .= "Project: ".$_POST['project_details']."\n"; $body .= "Translate to: ".$_POST['lang_target']." from ".$_POST['lang_source']."\n"; $body .= "by: ".$_POST['project_deadline']; $body .= "The text: ".$_POST['text_to_translate']; $body .= "Link to attachment: <a href=".$fileLink."> Link </a>"; Just helping me to figure out this would be enough but if anyone has a solution to the emailng as attatchment thing that would be even better. I've looked at a few tutorials but they seem a bit confusing. Thanks in advance.
  9. Thankfully I backed the DB up first It worked a treat. Thanks guys!
  10. Hmm... I tried this but it didn't seem to work properly UPDATE shop_prod SET price = price * .06 the prices ended up being reduced instead, for example a product that was £407 became around £24 What did I do wrong?
  11. LOL told you I was terrible at maths, thank you
  12. OK I'm sure this is a very easy question but I am terrible with mathematics and I can't get my head around this one. I have an ecommerce store and I want to increase all the prices on the site by 6%, is this the correct way to do it? UPDATE shop_prod SET price = price * 0.6 I'm sure the maths is wrong there and that is where I'm falling down I expect.
  13. Hi Guys, I've been using PHP for years now and I've gotten reasonably good at it but I'm now in the process of trying to learn jQuery. I'm trying to build a navigable image cycle, so far the cycle itself works quite nicely, but I want to be able to click on a number and have it move the slideshow to the related item. Here is the code I have so far: this.imageList = $('<ul class="theCycle"><li class="slideOne"><a href="/services/localisation"><img src="../../elements/imageCycle/imgCycle1.jpg"></a></li><li class="slideTwo"><a href="/services/technical-translation"><img src="../../elements/imageCycle/imgCycle2.jpg"></a></li><li class="slideThree"><a href="/services/proofreading--qa"><img src="../../elements/imageCycle/imgCycle3.jpg"></a></li><li class="slideFour"><a href="/services/desktop-publishing"><img src="../../elements/imageCycle/imgCycle4.jpg"></a></li></ul>'); this.navigation = $('<ul class="numNav"><li class="one">1</li><li class="two">2</li><li class="three">3</li><li class="four">4</li></ul>').appendTo('.imageCycle'); this.slide = function() { $('.imageCycle').find('.theCycle li').first().animate({ 'opacity' : 0 } ,'slow', function() { $(this).appendTo('.theCycle').animate({'opacity' : 1}); }); $('.numNav li').click( function() { if( $(".one").imageList.find(".slideOne").appendTo("imageCycle")); if( $(".two").imageList.find(".slideTwo").appendTo("imageCycle")); if( $(".three").imageList.find(".slideThree").appendTo("imageCycle")); if( $(".four").imageList.find(".slideFour").appendTo("imageCycle")); }); } I've no doubt I've done this terribly (I'm open to suggestions) and I DO place to replace the 4 'if' statements with a switch (assuming Javascript has them) but I'm completely baffled as how to get the correct slide to appear when you click on the correct number. Any help would be much appreciated.
  14. Still getting the same error. Could it be that the p.* has been referenced before it has been created? Thanks by the way, that would no doubt have caused further headaches later
×
×
  • 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.