
gecko
Members-
Posts
21 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
gecko's Achievements

Newbie (1/5)
0
Reputation
-
Copying and concatenating 2 different form field values
gecko replied to gecko's topic in Javascript Help
I'ver deleted everything that I did for it, as it wasn't working - it was only adding one value at a time. So I thought I must have been doing somethi the lookout for anyone who may have done something similar for one of their sites Any suggestions would be great, as Im no expert -
Hi, Im looking for a piece of javascript I can incorporate into some web forms I have got for adding student and staff records to a db. Basically, each form firstly requests for firstName and surname for the new user's record. Further down the form, it then asks for the user's email address. What I want to do is take the value entered in the FirstName field and the Surname field, concatenate them together to make an email address suggestion in the email field. So, if firstName was 'joe' and surname was 'bloggs', then the suggested email value could be = [email protected] Any ideas? I have written some stuff myself, but it isn't working for adding 2 values; at present, when the surname is completed, the surname value replaces the firstName value in the email field. Any ideas from someone more experienced with JS would be much appreicated!!
-
Is it possible in PHP to validate user input using a specific input mask? I've searched everywhere, and the only way I know is to use Javascript, but I thought I'd just check if there are anyother ways. I'm wanting to ensure that users input the correct data in the right format. An example would be a username, set to 'u01234' for exmaple. So I would need to make an input mask that only allowed one text character followed by 4 digits. Any suggestions would be VERY helpful
-
Thanks for your replies. Although, I don't quite understand how the script can be dynamic with regards to using it with several forms; the file I'm assuming will have the values posted to it from a form, where the values and text fields will be different with each form, so I don't understand how the 'field1' and 'value1' variables can acept data from different forms. Sorry for my stupidity if I'm missing something!
-
That looks about right, guys. One question : how do I define the fields and values used? I should think I would be POSTing them to this file, but not sure how to handle them. There could be 2 fields on one occasion, whereas on another occasion. there may be 5 fields to be inserted, together with their values. Any ideas? Thanks again
-
Hi, Hopefully I can make myself clear here on what I'm trying to do I'm looking for a way to have a single insert script thgat inserts records into a mySQL DB, with the ability to insert into different tables - one file inserts all, was what I was hoping So, instead of having many different files that insert records into different ables with different attributes and values, I;m trying to find a way to have ONE insert file, that can handle different insert requests to different tables, just basically to save time and cut back on the number of files in a directory. For the site I;m doing, I have a lot of functionality, mainly with insert queries (e.g - add assignment, add student, add staff, etc etc) It would just make sense to have one file that could insert into m,any different tables depending on the varibales sent from a previous form. For exmaple, instead of INSERT INTO tblStudent, a script may read INSERT INTO $table; $table being a value sent from a previous form, like "student". Hopefully this all makes sense; I just can't work out how to do this, nor do I even know if this is possible! Any suggestions would be much appreciated!
-
Hi, I've tried both back ticks and single quotes, but using either of those returns the same error message It still returns the syntax error unfortunately
-
Hi, Im having problems querying a database that is running on an older version of mySQL: version 4.1.22 Whenever I run an insert query from a PHP file, I get the following error message : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use I know the SQL query executes fine on a newer version of mySQL, but upgrading the version through my web host isn't an option. I've had a brief look in the documentation for any particular differences in how to write the query for version 4.1.22, but I can't see any differences! I am currently using the following query to insert a record, which returns the error shown above. $query = "INSERT INTO tblguestbook (id, from, email, comment) VALUES (NULL, `$from`, `$email`, `$comment`)"; $insertresults = @mysql_query($query)or die(mysql_error()); Any ideas on how to solve this problem would be greatly appreciated!
-
Just found out one of the files (the neurology one) had a load of random html scrambled around in it - strange! Anyway, cleaned it up and it works fine now, so many thanks for all your help! Hopefully I don;t have any other problems! Its always the smallest errors that create the biggest holdups when writing PHP I find! Thanks!
-
Hi, Thanks for both your replies. I removed the single quotes around the $topic varibale, and it now work ..BUT..... With solving another problem, I always seem to create another! On the first PHP page, there are 2 links..... One is <a href="index.php?pageid=browsearticles&&topic=smoking">Smoking</a> The other is <a href="index.php?pageid=browsearticles&&topic=neurology-neuroscience">Neurology-Neuroscience</a> There are the 2 links that send the variable $topic to the next page. For some reason, clicking the Smoking link works fine and returns data specific to the smoking.xml file fine. But, when the Neurology link is clicked, this strange error is returned : Warning: simplexml_load_file() [function.simplexml-load-file]: neurology-neuroscience.xml:6: I/O warning : failed to load external entity "DTD/xhtml1-strict.dtd" Whats the deal with the DTD being printed as the $topic variable, when it was clearly sent using $_GET from the previous page? Its strange how the error only occurs with the neurology.xml file, and not the smoking.xml file. Maybe a problem with the xml file? Many thanks for your continued help!
-
Hi, Hopefully someone can help me sort out what I'm trying to do. Basically, I have a PHP page with a $_GET variable, which takes the value of a topic name ($_GET['topic']) from a previous page. This is stored in a variable called $topic. I am basically trying to use that value stored in a piece of PHP which retrieves data from an xml file. I know what I want to do; it just isn't working, and maybe I am not writing it correctly, or there may be a better way of doing it. The next piece of PHP after setting the $topic is : $items = simplexml_load_file("'$topic'.xml"); $items = new SimpleXMLElement("'$topic'.xml", null, true); Hopefully, what I'm trying to do is clearer now! So I want to use the topic name sent from a previous page in a link to parse a xml file named with the value in $topic. Hope I've made myself clear. The error I am getting from using the above script is : Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "'neurology-neuroscience'.xml" As you can see, the variable $topic is being printed into the statement fine, but it still returns the error. NOTE: the file named neurology-neuroscience.xml does exist locally in the same directory, so the error isn't due to the file not being present. Any help on this would be greatly appreciated
-
I've managed to convince the client that her desired font isn't the best choice for use in the website, and advised her that the use of a more common font would be better. I think this is the only realistic approach; keep it simple! I just created a font-family class in CSS, with Bradley Hand ITC first, and then my client's second preferred font (which is more common) as Comic Sans MS, followed by Verdana. Viewers that DO have Bradley Hand ITC installed will view the text as Bradley; viewers that don't have it installed will have it displayed to them in Comic Sans MS. Thanks for all your suggestions!
-
So basically, there is no solution to this problem? A bit disappointing, as it NEARLY worked; although why some characters display correctly, and others don't, I'll never know! Thanks Mchl
-
Take a look at this screenshot of a website I am doing at the moment; I have been embedding the Bradley Hand ITC font by request of the client, which should display as a 'handwriting' style on most of the text on the website. http://www.annbrierley.co.uk/fontProblem.JPG However, when the website is viewed on a PC that has NOT got Bradley Hand ITC font installed, the text displays as shown the screenshot above! (A mix of Times New Roman and Bradley Hand ITC fonts all mixed together, when it should all be displayed as Bradley!) I can't think what could be causing this problem, so I'm totally confused! I used Microsoft WEFT to generate an .eot file so that the font can be viewed on all PC. Any suggestions, would be greatly appreciated!
-
www.joespetsupplies.co.uk/products.php