mcallaro88
-
Posts
11 -
Joined
-
Last visited
Never
Posts posted by mcallaro88
-
-
thorpe that is my code I don't have a problem with the code. I just don't know how to get the date to display the way I'd like it. Everything works fine and displays properly but I have no clue how to change the time to what I want. Do you know how I could get it to display that way?
-
Hello. I'm new to pHp and I would like to know how to get my $date_posted to read as March 12, 2012, instead of 2012-12-03.
Here is the code:
<?php $sql = " SELECT id, title, date_posted, summary FROM blog_posts ORDER BY date_posted ASC LIMIT 10 "; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; $title = $row['title']; $date_posted = $row['date_posted']; $summary = $row['summary']; echo "<h3>$title</h3>\n"; echo "<p>$date_posted</p>\n"; echo "<p>$summary</p>\n"; echo "<p><a href=\"post.php?id=$id\" title=\"Read More\">Read More...</a></p>\n"; } ?>
I have tried the date() function but it always updates with the current time & date so I'm a little confused on how I get this to work.
-
Nope I don't know why it is saying undefined lol. I bet its something really small but I don't know what it could be. I have been trying to get this for like hours and I'm getting frustrated. Gotta love code.
-
I have a php page and I'm using jQuery and some AJAX to validate my contact form (phpmailer & process.php). However, the message is never displayed in my email. The name, email, and subject get passed but the message always comes back as Message: [object HTMLTextAreaElement]. Now it comes back as undefined. I don't know whats wrong.
Thanks for all who help - MIKE
Here is the code
===============================================================
$(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".button").click(function() { // validate and process form // first hide any error messages $('.error').hide(); var name = $("input#fName").val(); if (name == "") { $("label#fName_error").show(); $("input#fName").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var subject = $("input#subj").val(); if (subject == "") { $("label#subj_error").show(); $("input#subj").focus(); return false; } var message = $("input#memo").val(); if (message == "") { $("input#memo").focus(); return false; } var dataString = 'fName='+ name + '&email=' + email + '&subj=' + subject + '&memo=' + message; //alert (dataString);return false; $.ajax({ type: "POST", url: "bin/process.php", data: dataString, success: function() { $('.formContainer').html("<div id='message'></div>"); $('#message').html("<h2>Contact Form Submitted!</h2>") .append("<p>I will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#message').append("<img id='checkmark' src='images/check.png' />"); }); } }); return false; }); }); runOnLoad(function(){ $("input#fName").select().focus(); });
-
$(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".button").click(function() { // validate and process form // first hide any error messages $('.error').hide(); var name = $("input#fName").val(); if (name == "") { $("label#fName_error").show(); $("input#fName").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var subject = $("input#subj").val(); if (subject == "") { $("label#subj_error").show(); $("input#subj").focus(); return false; } var message = $("input#memo").val(); if (message == "") { $("input#memo").focus(); return false; } var dataString = 'fName='+ name + '&email=' + email + '&subj=' + subject + '&memo=' + message; //alert (dataString);return false; $.ajax({ type: "POST", url: "bin/process.php", data: dataString, success: function() { $('.formContainer').html("<div id='message'></div>"); $('#message').html("<h2>Contact Form Submitted!</h2>") .append("<p>I will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#message').append("<img id='checkmark' src='images/check.png' />"); }); } }); return false; }); }); runOnLoad(function(){ $("input#fName").select().focus(); });
-
@thorpe - alright I wasn't aware you had an ajax board just thought it was php. I didn't really have a chance to browse the site yet but thanks.
@AlexWD - I changed it to message and that's what I got was an undefined message.
-
Yes I'm aware an I'm asking a question about php with some AJAX thats all. I've been trying to figure this out all day and nothing so I need some help. Is there a problem with what I'm asking?
-
Ok I did what you said and now I'm getting a an undefined. I have no idea what that means. Why am I getting this error?
-
Sorry about that I knew I forgot to put something lol here is the AJAX stuff
$(function() {
$('.error').hide();
$('input.text-input').css({backgroundColor:"#FFFFFF"});
$('input.text-input').focus(function(){
$(this).css({backgroundColor:"#FFFFFF"});
});
$(".button").click(function() {
// validate and process form
// first hide any error messages
$('.error').hide();
var name = $("input#fName").val();
if (name == "") {
$("label#fName_error").show();
$("input#fName").focus();
return false;
}
var email = $("input#email").val();
if (email == "") {
$("label#email_error").show();
$("input#email").focus();
return false;
}
var subject = $("input#subj").val();
if (subject == "") {
$("label#subj_error").show();
$("input#subj").focus();
return false;
}
var message = $("input#memo").val();
if (message == "") {
$("input#memo").focus();
return false;
}
var dataString = 'fName='+ name + '&email=' + email + '&subj=' + subject + '&memo=' + memo;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "bin/process.php",
data: dataString,
success: function() {
$('.formContainer').html("<div id='message'></div>");
$('#message').html("<h2>Contact Form Submitted!</h2>")
.append("<p>I will be in touch soon.</p>")
.hide()
.fadeIn(1500, function() {
$('#message').append("<img id='checkmark' src='images/check.png' />");
});
}
});
return false;
});
});
runOnLoad(function(){
$("input#fName").select().focus();
});
-
I have a php page and I'm using jQuery and some AJAX to validate my contact form (phpmailer & process.php). However, the message is never displayed in my email. The name, email, and subject get passed but the message always comes back as Message: [object HTMLTextAreaElement]. Could someone tell me what I'm doing wrong I've tried everything but nothing is working.
Thanks for all who help - MIKE
Here is the form HTML
-------------------------------------------------------------------------------------------------------------------
<div id="forminfo">
<form name="contact" method="post" action="">
<dl>
<dt id="name"><label for="fName" class="">Name</label></dt>
<dd><input type="text" class="text" name="fName" id="fName" style="width:200px; height:20px;" /></dd>
<label class="error" for="fName" id="fName_error">This field is required.</label>
<dt id="eMail"><label for="email" class="">Email</label></dt>
<dd><input type="text" class="text" name="email" id="email" style="width:200px; height:20px;" /></dd>
<label class="error" for="email" id="email_error">This field is required.</label>
<dt id="subject"><label for="subject">Subject</label></dt>
<dd><input type="text" size="8" maxlength="40" name="subject" id="subj" style="width:200px; height:20px;" class="text" /></dd>
<label class="error" for="subject" id="subj_error">This field is required.</label>
<dt id="comments">Message</dt>
<dd><textarea name="memo" class="text2" id="memo"></textarea></dd>
<dd><input type="submit" class="button" id="submit" name="submit" value="" /></dd>
</dl>
</form>
</div><!--forminfo-->
Here is the php
-------------------------------------------------------------------------------------------------------------------
<?php
if ((isset($_POST['fName'])) && (strlen(trim($_POST['fName'])) > 0)) {
$name = stripslashes(strip_tags($_POST['fName']));
} else {$name = 'No name entered';}
if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) {
$email = stripslashes(strip_tags($_POST['email']));
} else {$email = 'No email entered';}
if ((isset($_POST['subj'])) && (strlen(trim($_POST['subj'])) > 0)) {
$subject = stripslashes(strip_tags($_POST['subj']));
} else {$subject = 'No subject entered';}
if ((isset($_POST['memo'])) && (strlen(trim($_POST['memo'])) > 0)) {
$comments = stripslashes(strip_tags($_POST['memo']));
} else {$comments = 'No message entered';}
ob_start();
?>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<table width="550" border="1" cellspacing="2" cellpadding="2">
<tr bgcolor="#eeffee">
<td>Name</td>
<td><?=$name;?></td>
</tr>
<tr bgcolor="#eeeeff">
<td>Email</td>
<td><?=$email;?></td>
</tr>
<tr bgcolor="#eeffee">
<td>Subject</td>
<td><?=$subject;?></td>
</tr>
<tr bgcolor="#eeffee">
<td>Message</td>
<td><?=$comments;?></td>
</tr>
</table>
</body>
</html>
How to get a date from a blog post to read Full month, Date, and Year?
in PHP Coding Help
Posted
Thanks timmah1!