Jump to content

wcdeswardt

Members
  • Posts

    12
  • Joined

  • Last visited

About wcdeswardt

  • Birthday 05/29/1963

Previous Fields

  • Languages
    English

Profile Information

  • Location
    New Zealand
  • Interests
    Starting with selfstudy in PHP and MySQL.

wcdeswardt's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. I have the follwing code in PHP: if(is_numeric($first_name[0]) === true){ //Do something} How would I be able to do the same check using JavaScript. I also would like to get a PHP script to check if there is a number in $first_name at all, as I don't want the user to add a number in their first or last names at all.
  2. Hi there. I created a from with multiple required fields that the users my complete. Then I also have 3 checkboxes of which the user must select at least one of them. When the user submit the form I start doing the checks and each error I find I store in an array. If there are any errors I display the errors for the user plus the form with the values that the user already entered. This bit work fine. I want to know how I would be able to return a checked checkbox if the user checked any of then and any amount, but none, fo them? With from fields it's easy: <input type="text" name="First_Name" value="<?php echo $First_Name; ?>" /> My question is in what way I would be able to get the result of my checkbox the user select? My guess is that it might be something like: if(isset()) But I am not sure. Any help on this please?
  3. What I have in mind is the following. I have several forms that users have to enter data in. Each form has several fields that are required fields. The idea that I have is to maybe define a variable of array type e.g. reguiredFields = array('Field 1','field 2','field 3'); . This is on form 1. On form 2 I might also have different fields that I also make use of the variable requiredFields = array(); and the same with all my other forms. I only want one function to check if all required fields are completed and for each field that is empty it must return an error for that field, e.g. First name is a required field. Last Name is a required field and so on. Is it possible at all?
  4. Thank you, but how should my code look inside the function that is the bit that I don't know, in other words how the code is going to do the actual checking.
  5. How can I create a user defined function to check if the user completed all required fields in a form, e.g. like required_fields = array(); required_flieds(field_name1,field_name2); function checkRequiredFields(); I need to be able to put any field name in the array and send that information to my function that will check for empty fields and then return an error on each field where it finds an error. Any help please?
  6. As you I am also a beginner in OOP and PDO. I have done a tutorial in this regard and you might find it helpful. You can find the code here:http://www.timkipptutorials.com/scripts/download.php?action=dl&fid=13 And the document here:https://docs.google.com/file/d/0B0fx_EGx3tG_SGFwcmZDMlJQbFE/edit?usp=sharing
  7. I am also a beginner in PHP. I have searched the Internet to see if I can find a tutorial where OOP and PDO are used with each other. I have tried a very simple one and is working running on a WAMP server. I am not sure if I can publish the link here so if you want access the the tutorial message me and I can give you the link to the sources files or an online document.
  8. Yes it is. I have in my www root directory a folder called contact, which is my root folder for my contacts app. Inside my contacts folder I have two folders, the one is called includes and the other is called classes. In my includes folder I have a test file and I don't require any files in that file. Then I have another test file in my classes directory. In this file I require the file that lives in my includes directory. So what I did in my class file is: require_once '../includes/myincludefile.php'; No help me if I am wrong, the "../" tells the system to go down on level in the directory structure, which in this case means that it should go into my contact folder and then I have includes now telling the system from ../ you now need to go into includes? Everyting is lowercase so that is not the issue. It is almost as if Ubuntu looses the current directory that it in at that point in time. So to go further, now I have my index file in my contacts root where I then include the classes file using: require_once 'classes/myclassfile.php'; As I said I have a temp fix now that works and that is : require_once (__DIR__.'/../includes/myincludesfile.php'); inside my classes file. There is a link to my tutorial higher up in the post where you can actually go and look at the code.
  9. What I forgot to say is that if I do the following everything works fine: require_once '/var/www/contact/includes/myincludefile.php'; in my classes file that lives in my classes folder, hence the reason I originally coded it as: require_once '../includes/myincludefile.php';
  10. Here is the error that I get when I want to display the page: Warning: require_once(../includes/testincludes.php): failed to open stream: No such file or directory in /var/www/contacts/classes/testclasses.php on line 3 Fatal error: require_once(): Failed opening required '../includes/testincludes.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/contacts/classes/testclasses.php on line 3 Any idea where I can fix this please?
  11. I am a beginner in PHP MySQL and I wrote a little tutorial that makes use of OOP and PDO combined. Everything works fine in my devel area which is WAMP running on Windows 7 but it is not working on the Ubuntu box. The directory structures on both webservers are looking exactly the same. So when I need to include a file in another file, a class file, that lives in a different directory (classes) I made use of this: require_once '../includes/myincludefile.php'; to include the file in my class file. Now in my index.php file I would include my class file as follows: require_once 'classes/myclassfile.php'; Even If I just echo out on each file where it lifes my index.php page presents me with a blank screen not echoing out what I echoed on each page in each directory. I have a tutorial document online as well to have a look at my code. My permissions on my www folder on my Ubuntu box is -R 777 PHP MySQL Tutorial - https://docs.google.com/document/d/1U1qsutbAuZLEVrd99hSmSOD0o7NRtAO6whL-WKhnu6Q/edit
×
×
  • Create New...