Jump to content

firestarter30

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by firestarter30

  1. @kenrbnsn I get the JSON parse error only when the mail function is inside the script any ideas why?
  2. Hmmmm I go this error while using the array : There was an SyntaxError: JSON.parse error due to a parsererror condition. This is the ajax call with the error status massages to help you a little understand my logic function submitForm(formData) { $.ajax({ type: 'POST', url: 'feedback.php', data: formData, dataType: 'json', cache: false, timeout: 5000, success: function(data) { $('form #response').removeClass().addClass((data.error === true) ? 'error' : 'success') .html(data.msg).fadeIn('fast'); if ($('form #response').hasClass('success')) { setTimeout("$('form #response').fadeOut('fast')", 5000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { $('form #response').removeClass().addClass('error') .html('<p>There was an<strong> ' + errorThrown + '</strong> error due to a<strong> ' + textStatus + '</strong> condition.</p>').fadeIn('fast'); }, complete: function(XMLHttpRequest, status) { $('form')[0].reset(); } });
  3. I have been having some issues with the above functions and while the mail was sent , it was looking kinda weird :-\ Im facing 2 problems: 1st: implode() , or print_r() didnt worked for me , i guess i should be using a foreach statement but i never stadied seriously the arrays. 2nd: Always a JSON parse error, or invalid JSON error comes out when the email() code exitsts... Here is the code below $name = trim(stripslashes(strip_tags($_POST['name']))); $email = trim(stripslashes(strip_tags($_POST['email']))); $url = trim(stripslashes(strip_tags($_POST['url']))); $title = trim(stripslashes(strip_tags($_POST['title']))); $anchortext = trim(stripslashes(strip_tags($_POST['anchortext']))); $description = trim(stripslashes(strip_tags($_POST['description']))); $dropdown = $_POST['dropdown']; $receiver = "example@gmail.com" ; $email_body = array($name,$email,$url,$title,$anchortext,$description,$dropdown); if (!empty($name) & !empty($email) && !empty($url) && !empty($title) && !empty($anchortext) && !empty($description) && !empty($dropdown) ){ // i guess all juice goes here $send = mail($receiver, 'Link Exchange Request', "$email_body", "From: {$email}"); if ($send) { echo 'true'; } } I would like the mail to be presented like Name : blabla Email : blabla@blabla.com Url : blablablabla and so on .. Suggestions?
  4. It worked like a charm nogray , thanks a lot :D :D
  5. Hi all , something short i would like to validate a drop down menu , here is the html code <label for="Website type">Website Type</label> <select name="dropdown"> <option selected="selected">Select A Category</option> <option value="sites">Sites</option> <option value="directories">Directories</option> <option value="blogs">Blogs</option> </select> From the javascript part i tried to validate with this : var dropdown = $('form #dropdown').val(); if(dropdown =='Select A Category'){ valid = '<p>A valid website choice ' + required +'</p>'; } //I tried also with (dropdown =='Select A Category') , (dropdown ='') but didnt worked either. What im missing here? PS: Just for the history , when i was trying to validate the dropdown menu in php , i was assuming that because the "Select A Category" hasnt assinged any value , it would be empty, but after i got suspicious and echo the menu just to see what is happening it echoed Select A Category and when validating like this if ($dropdown == 'Select A Category') { $error_message .= "<p>Please choose your website type.</p>"; } it was working as expected. But is javascript this doesnt work.
  6. Hello , Im trying to make a very simple link trade script , which checks in a page exists and after searches to that page to find a link (in this case my link). But i got stuck in the lalst step of finding my link on a given page. Hope you can help me with that <?php require_once('Connections/my_conn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $myurl= 'http://mywebsite.com'; //check if the remote site url exists function url_exists($url) { $ch = @curl_init($url); @curl_setopt($ch, CURLOPT_HEADER, TRUE); @curl_setopt($ch, CURLOPT_NOBODY, TRUE); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $status = array(); preg_match('/HTTP\/.* ([0-9]+) .*/', @curl_exec($ch) , $status); } //check if my link exists in the remote site if(($status[1] == 200) && ($myurl== )); { //Insert into database code here } ?> I would like a little help on how to check if my link exist in the trader's url. Thanks in advance
  7. Ok seems that after a lot of reasearch i did it. Something i came up with , was the date format according to RFC2822 standars and here is how to output the date. <pubDate>" . gmdate(DATE_RFC2822,strtotime($row['dateColumn'])) . "</pubDate>
  8. Hello all That forum is my last desperate attemp to do what i want to do. Ok here is the story I want to create a simple rss feed in conjuction with php and mysql. I dont want admin areas ect , i just want when i insert a new listing to my database to be able shown up to my (future) rss subscribers. To be more technically specific i want to show to my surfers updates about 2 tables in my database not all the tables. The example i found so far were about only 1 table, plus i was encounting errors to my script. I would like some ideas, directions if someone is kind enough to help a sad developer :'( Thanks in advance!
  9. The drop down menu is named "link_submission" . Thing is that i can not find a way to say to the drop dowm menu 'send the choosen option for switch()ing' , for the proper insertion to the database to take place. I think now you got my way of thinking.
  10. @akitchin You are right, something like this was spinning to my mind also.. The $site_type , is not coming from the url , this variable is declared by me. Thought that i could "catch" the option from the drop down menu... in order to insert to the proper choosen table (category) , silly me uh? Im prety sure something im missing here...
  11. Hello all Ok here is the problem... I want when a user inputs the requested data to the text fields , the script to insert those data in the prope table depending on the choise the user does by choosing one option from the drop down menu. Below is the php code (apparently not working) $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } $site_type = $_REQUEST['category_selection']; if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Web_Sites")) { $insertSQL = sprintf("INSERT INTO partner_sites (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['url_field'], "text"), GetSQLValueString($_POST['title_field'], "text"), GetSQLValueString($_POST['anchor_field'], "text"), GetSQLValueString($_POST['description_field'], "text"), GetSQLValueString($_POST['webmaster_nane_field'], "text"), GetSQLValueString($_POST['webmaster_email_field'], "text"), GetSQLValueString($_POST['category_selection'], "text")); mysql_select_db($database_content_conn, $content_conn); $Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error()); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Blogs")) { $insertSQL = sprintf("INSERT INTO partner_blogs (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['url_field'], "text"), GetSQLValueString($_POST['title_field'], "text"), GetSQLValueString($_POST['anchor_field'], "text"), GetSQLValueString($_POST['description_field'], "text"), GetSQLValueString($_POST['webmaster_nane_field'], "text"), GetSQLValueString($_POST['webmaster_email_field'], "text"), GetSQLValueString($_POST['category_selection'], "text")); mysql_select_db($database_content_conn, $content_conn); $Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error()); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Directories")) { $insertSQL = sprintf("INSERT INTO partner_directories (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['url_field'], "text"), GetSQLValueString($_POST['title_field'], "text"), GetSQLValueString($_POST['anchor_field'], "text"), GetSQLValueString($_POST['description_field'], "text"), GetSQLValueString($_POST['webmaster_nane_field'], "text"), GetSQLValueString($_POST['webmaster_email_field'], "text"), GetSQLValueString($_POST['category_selection'], "text")); mysql_select_db($database_content_conn, $content_conn); $Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error()); } And the html form <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="link_submission" id="link_submission"> <table width="630" border="0" align="center" cellpadding="5" cellspacing="5"> <tr> <td width="76">URL:*</td> <td width="519"><label for="url_field"></label> <span id="sprytextfield1"> <label for="url_field"></label> <input name="url_field" type="text" id="url_field" size="50" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td> </tr> <tr> <td>Anchor Text:*</td> <td><label for="anchor_field"><span id="sprytextfield2"> <input type="text" name="anchor_field" id="anchor_field" /> <span class="textfieldRequiredMsg">A value is required.</span></span></label></td> </tr> <tr> <td>URL Title:*</td> <td><label for="title_field"><span id="sprytextfield3"> <input type="text" name="title_field" id="title_field" /> <span class="textfieldRequiredMsg">A value is required.</span></span></label></td> </tr> <tr> <td>Description:*</td> <td><span id="sprytextarea1"> <label for="description_field"></label> <textarea name="description_field" id="description_field" cols="45" rows="3"></textarea> <span id="countsprytextarea1"> </span><span class="textareaRequiredMsg">A value is required.</span><span class="textareaMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td>Webmaster Name:*</td> <td><label for="textfield2"><span id="sprytextfield4"> <input type="text" name="webmaster_nane_field" id="webmaster_nane_field" /> <span class="textfieldRequiredMsg">A value is required.</span></span></label></td> </tr> <tr> <td>Webmaster E-mail:*</td> <td><label for="textfield3"><span id="sprytextfield5"> <input name="webmaster_email_field" type="text" id="webmaster_email_field" size="40" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></label></td> </tr> <tr> <td>Category:*</td> <td><span id="spryselect1"> <label for="category_selection"></label> <select name="category_selection" id="category_selection"> <option>Select An Option</option> <option value="Web_Sites">Web Sites</option> <option value="Blogs">Blogs</option> <option value="Directories">Directories</option> </select> <span class="selectRequiredMsg">Please select an item.</span></span></td> </tr> <tr> <td> </td> <td><label for="select"></label> <input type="submit" name="button" id="button" value="Url Submission" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="link_submission" /> </form> Im begging for your help.....
  12. Hello, Never did this in the past , so i need some guidelines I have made already the back end programming for uploading my flash movies, to the server but no idea on how to play them. Im planning to have a few rows of videos , lets say 5x5 with pagination, and the user to click on a movie and redirect to a page for viewing it. That means that with one singe flash object with a repeat region, but i dont know how to code the dynamic part for the movie, so the recorset to pic the proper one based on the user selection. I know how to do this with pictures, but once that i tried with movies i go comfuced and left it. I would like your advices pls. Thanks
  13. Ok the hearder of the tab was the problem as i saw. I made it 34 pixels, and came back to normal. It was streching till the end of the page. Keep this solution in mind if anyone will face a similar problem.
  14. Hmmmmmm Guys is a css problem... When i remove the link to my main css file which formats all the page (ok all the layout is messy), but all jquery objects look perfect exactly as desined with the theme roller. Anyone knows what should i do in this case?
  15. I did that.... But while the accordion is working ... the tabs for some reason doesnt want to work
  16. When i said onjects i mean 2 different jquery objects , accordion,tabs ect. <head> <link rel="stylesheet" type="text/css" href="jquery-ui-1.8.4.custom/css/jquery/jquery-ui-1.8.4.custom.css"/> <script type="text/javascript" src="jquery-ui-1.8.4.custom/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery-ui-1.8.4.custom/js/jquery-ui-1.8.4.custom.min.js"></script> <script type="text/javascript"> $(function(){ $('#tabs').tabs(); }); </script> </head> <body> <div id="tabs"> <ul> <li><a href="#tabs-1">First</a></li> <li><a href="#tabs-2">Second</a></li> <li><a href="#tabs-3">Third</a></li> </ul> <div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div> <div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div> <div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div> </div> </body> For some reason this is not working...i looked at the code of the demo page that is inside the download pack from jquery site, and i have everything in place i dont know what is wrong. Any ideas?
  17. Hello all, I used adobe widget browser to download a jquery accordion panel. I edited it ,made it how i wanted ...everything ok. After i did the same thing for jquery tabbed pannels.. , but even if the holders are different, accordion points to jquery1.7.2 , and tabbed panels to 1.73 , they are not working and their layouts is completely lost when im using them together. When they are used seperately they are working fine. Can anyone tell what the issue here ? Thanks
  18. Ok problem solved by following this tutorial, http://www.dougv.com/blog/2009/06/13/sorting-your-mysql-results-set-in-php-using-jquery-and-a-more-traditional-approach/ be careful to use the same "case" as coloumn names if you dont want to use numbers like this one, and to give your surfers this way, a better experience.
  19. ok here is the code : <?php require_once('Connections/db_conn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_db_conn, $db_conn); $query_users = "SELECT user_id, user_name, age, height, weight FROM users"; $users = mysql_query($query_users, $db_conn) or die(mysql_error()); $row_users = mysql_fetch_assoc($users); $totalRows_users = mysql_num_rows($users); ?> <!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" /> <title>Users</title> </head> <body> <div id="sort">Sort Users by: <a href="users.php">Name</a> | <a href="users.php">Height</a> | <a href="users.php">Weight</a> | <a href="users.php">Age</a></div> </body> </html> <?php mysql_free_result($users); ?>
  20. Hello to all phpfreaks out there I need help with sorting some database columns. I ve been searching all day but i didnt found something nice to implement (or my mind is too tired to think right at this specific time) I have a table and inside it i display a picture and some other data.Above the table i inserted a div and inside it i have 5 links which when clicking on them i want to change the display order of the data being displayed in the table, and if clicked again to change again the state for ASC to DESC and so on... Is there any short solution that do the trick? With an array maybe? PS:I have also a pagination which i would like to keep the sorted order from the above table so not to mess around with the results. Thanks in advance
  21. Hmmm i think it was from the beginning my mistake cause after i insert to the css a padding 5px left, and 5px right, the problem solved without any wordwrap php One other thing i would like to ask. Is there a way after a certain character length, lets say 100 , to output " ...more " so i can link "...more " to a details page? Thanks again for your time
×
×
  • 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.