-
Posts
827 -
Joined
-
Last visited
-
Days Won
9
Everything posted by fastsol
-
Option #1 sounds like a pretty normal method to me.
-
Beginner with beginner question re: listing specific file type
fastsol replied to trepaning's topic in PHP Coding Help
glob() would be a easier and faster way to get a list of files $files = glob('directory/*.mp3'); print_r($files); -
Maybe the issue isn't the header on the config but rather a header on the page you are linking to. Where does the $pagelink go to and what does that page do with the URL var? If there is a header on that page to go back to the index if something is wrong, maybe that's where the problem is.
-
The script test that Coreye gave was the most common way to test a mail(). If the mail never arrives it would indicate only a couple things. One, even though mail() is available on your server doesn't mean they have a mail service setup, to know that you would need to ask them or see if they have sample code of how to send mail on their servers. Two, their mail service is being over strict and marking any of your attempts as spam. Have you checked your spam forlder by chance to make sure they didn't arrive there instead? If they are in you spam folder by accident, you may really want to consider using the phpmailer library from http://phpmailer.worxware.com/ cause they have all the mail headers setup correctly and many other features you can do easily. That will help ensure "better" that your mail arrives in the inbox and not spam folders.
-
Interesting, I did not know that. He still hasn't defined a $tbl_name amongst other things wrong.
-
Is the server on a paid hosting account or localhost?
-
If you are trying to learn from what you are doing, great, I'm on my phone a it's hard to read your code right now. Otherwise i distribute a fully functional contact form here http://amecms.com/article/Easy-to-use-contact-form-with-validation that you can use
-
You need i move your prepare statement to just above your execute statement. The problem is that you are defining variables in the prepare before you actually declare the values of those variables. Plus i see nowhere where you define a value for $tbl_name
-
This is the correct way to use the code you have. session_start(); // Notice that the function declaration is now above where you call the function. function content() { echo 'My members page information I thought goes in here'; } if(!isset($_SESSION['username']) || $_SESSION['username']=="") { echo "Please login to see this page....."; } else { // This is considered a function call below. content(); }
-
What exactly doesn't work? The first thing to note is that the function you declare needs to go before the call of the function in your else{}. Remember that php works top-to-bottom, so if you try to use a var or function before it's actually declared it won't work. Also you would have know this if you have error_reporting(E_ALL) turned on.
-
What errors are you getting exactly. Based on what you posted, $body is not defined anywhere. Are you sure it's not supposed to be $row['body'] instead. Also you say you want the first 30 "words", substr() can't count the words, ony the characters. If you truly need the words then you'll need to do some more processing to achieve that. Here is a better example I think of your code <?php // Make a MySQL Connection $query = "SELECT * FROM jobs ORDER BY id DESC"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $charLimit = 25; $teaserText = substr($row['body'],0,$charLimit) . "... "; echo "<strong>"; echo $row['title']. " <br /> </strong>". $teaserText . " <br /><br />Salary: ". $row['wage'] . " <br />Closing Date: ". $row['expiry'] . " <br /><br />To apply for this position, please email your CV to ". $row['apply']; echo "<br /><br />"; } ?>
-
Your code is a bit of a mess. Check out this tutorial, it will help you organize your code http://amecms.com/article/How-to-validate-a-form-the-right-way
- 21 replies
-
- sticky
- field validation
-
(and 2 more)
Tagged with:
-
Most likely count() won't work in this instance cause it will include all $_POST elements including the submit button and any other form elements. The form elements that you are having issue with, are they all the same type of form element and are you processing them all in the same exact manner? If so then I would suggest using an array for the "name" attribute of the element, this way it will come across in the php in an array and you can run a foreach loop to process them. <input type="text" name="form_element[]"> // use a print_r($_POST); to see how the elements come across as an array print_r($_POST); foreach($_POST['form_element'] as $element) { echo $element; }
-
Ok I got that tutorial put together. http://amecms.com/article/Building-Chained-Select-Boxes-with-Jquery-and-PHP
-
It's a little confusing as to waht you are populating for each select box. The HTML you show already has the select box in it but your jquery indicates that you are dumping the code within the spans and loading the select box again with the options rather than simply polulating the options themselves. The issue might be that because you are populating the entire select box the DOM might not being seing the field with the methods you are using. I know you can certainly do it this way but I think you need to use different jquery methods like on() rather than change(). The jquery.com forum would be a better choice to ask these questions though. I have done this same thing a few times and it's pretty straight forward really, but I only polulate the <options>. If you have total control over all aspects I would suggest changing it so that only the options are populated and not the whole select box. I have been thinking of doing a tutorial on this subject, so maybe it's time. If I get it done I will repost here with a link.
-
I don't see anything that stands out as an issue in your code. Again, are you sure that <script> tags are actually being echoed to the page? Run your page in the browser and then do a view page source and see if they are in there. You could also post the view source result here and we can take a look.
-
Multiple item entry with edit and delete option
fastsol replied to rohanraj's topic in PHP Coding Help
I think I understand what you want. So you have a table displayed on the page with data and you want to hit a button "add" and have it make another table cell below that yo ucan continue to enter more in, then submit it all at once? Is that about right? Check an example of this http://demo.amecms.com/a.php?menu=Products&admin_page=purchaseorder&action=add and click the "add more rows" at the bottom. The demo login info is (case sensitive) username: admindemo password: Admindemo1 If that example is what you are looking for, it's not the somplest thing to do and involves javascript and ajax. -
Does <script>alert("Cannot be deleted!")</script> actually get echoed if you view the page source after the page loads? If it is there, what doctype are you using? I am no pro javascript guy by any stretch of the meaning but I believe that in most doctypes besides html5 you need to specifiy type="text/javascript" in the <script>, not sure if not having that will make it not work but worth a try.
-
I have a tutorial on this type of thing, it deals with the select box but the theory is the same, just change it to use the check box instead and use checked="checked" http://amecms.com/article/Retaining-Drop-down-Selection-After-Form-Submit
-
$title = $row['title'];
-
As stated previously, form validation can be tricky and complicated. I have made a tutorial on this subject that should help you. http://amecms.com/article/How-to-validate-a-form-the-right-way