-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
no need to put a function within a function Also, if you want to serialize THIS, and THIS is supposed to be a form... You shouldn't use the click() function of a button. You should use the submit function of the form... For example, if you have a form with an id of ... box, then you can serialize it like this $('form#box').submit(function() { var data = $(this).serialize(); }); It helps to read the manual too http://api.jquery.com/jQuery.post/ $.post("test.php", data, function(data) { alert("Data Loaded: " + data); }); The code above would send the data the way you wanted... and alert it back.. You can change the alert part to whatever you need... which I assume is $('#div_1').html($('#inner_1').html(data)); Even that selection can be simplified.. to $('#div_1 #inner_1').html(data);
-
if(isset($_POST['submit'])) { } You get a blank page because of this.... if($_POST['no10'] == "C") { $score += 10; } else { $errors[] = "Charlotte is the largest city in NC."; echo" Your score on the All About North Carolina quiz is ".$score; } If you answer incorrectly for question 10 it will echo something, because you end your else brace after your score statement... You need to end the else BEFORE the score statement. In other words,, your code should look like this ON TOP if(isset($_POST['submit'])) { and ON BOTTOM if($_POST['no10'] == "C") { $score += 10; } else { $errors[] = "Charlotte is the largest city in NC."; } echo "Your score on the All About North Carolina quiz is ".$score; } It really really REALLY helps to indent your code.
-
if($_POST['no10'] == "C") { $score += 10; } else { $errors[] = "Charlotte is the largest city in NC. "; } // NOT PHP CODE // NOT PHP CODE echo " Your score on the "All About North Carolina" quiz is ".$score." "; You get this error because the P tag isn't a php function or php anything... it's pure HTML. PHP doesn't parse HTML code like a browser, it assumes you mean P is greater than absolutely nothing at all and P is less than absolutely nothing at all And you got to admit, that makes absolutely no sense at all.
-
Close, but no cigar. First off, forget about tags and focus mainly on your PHP right now, you can add your HTML in later. The reason I say this is because you open an html tag and then close it directly before you display output. HTML output is meant to be inside those html tags, but regardless, you can still use HTML tags.. like etc... just fine. The browser will figure it out. As for your PHP, you're going about getting the data all wrong. $score=0; if(isset($_POST['submit'])) { } This part is the only part that's correct.. logic-wise. Syntax-wise, everything is fine. The point of having isset( $_POST['submit'] ) is to check that a user USED the form... Then, once you know that they used the form, you can do your coding... and you get your values the same way as the submit button For instance, if you want to check the value of no1, do this, similar to the way you did already. if ($_POST['no1'] =="B") { $score += 10; } else { $errors[] = "The American Dogwood is the state flower of NC."; } Note the use of TWO equals signs ... This is used to COMPARE Note the use of += to add onto $score Note the use of $errors[] it will add on to that array. Then you can just echo everything at once. There is plenty to learn and plenty more to learn, but see if you can take this and come up with something. Oh, and to show your errors.. use this little snippet of code at the end foreach($errors as $error) echo $error . " \n";
-
You HTML looks pretty much perfect now. Yes, and it's called CSS (Cascading Stylesheets) I wouldn't worry about it right now, but all it involves is putting this in your head tag <br /> ol li {<br /> padding-bottom: 10px;<br /> }<br /> Now you need to post the code for your quizresults.php page if you have any at all.. I gave you the building blocks to it in my last post.
-
Looks good Allie, ... you don't exactly have a doctype set so telling you to change to won't make much difference. Maybe you just forgot to post the rest of your HTML, because the bottom half is missing. There is no submit button for your second form (The quiz form).. which I don't understand why it points to NorthCarolina.php Your first form points to quizresults.php, but it only has two form fields... do you even need that form anymore? tags are automatically put on another line.. so there's no point in having a after each list item .. aka So long as you have a submit button, you should be ready for your PHP.. This will involve using arrays and the use of the isset function. The first thing to do in your PHP script... that is after you fix your HTML.. is to check for the submit button In order to check for it, it must have a name. So if your submit button looks like this Your PHP will look something like this if(isset($_POST['submit'])) { /* Quiz grading code inside here */ } ?> If you can, provide me with a link to your page so I can see what it looks like.. and offer a few tips
-
Along with that, here's a decent tutorial on making an email form http://www.thesitewizard.com/archive/feedbackphp.shtml
-
Here's a good starter form for you to mess with Just replace this with your old form tag </pre> <form action="'contact.php'" method="'POST'"> Name: Email: </form This will send the data to contact.php using POST... I'll explain that as we go along.
-
So, given that you had no form to begin with, what exactly are you wanting in the form? - Dropdowns? - radio buttons - checkboxes - text inputs In other words... what is this form supposed to do?
-
This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=346552.0
-
You don't need this line, because you've already opened the body tag .. right before your img tag. So get rid of that for starters. Next, you need to actually have a form. You can easily start one where you deleted that line I'm talking about. "Every kid - no matter where he or she lives in NC - must graduate from high school with what it really takes to succeed in a career, in a two- or four-year college or in Technical training." - NC Governor Beverly Perdue Interested in learning more about Governor Perdue and what she has done for the people of North Carolina? Click here to visit the Official Web Site of the State of NC. </pre> <form action="'yourPHPfile.php'" method="'POST'"> </form If you still want to keep the lightblue, you can always add it to the opening body tag... just as you did with the one I told you to delete.
-
Alright Allie, welcome. First off, it would help a lot more if you post the HTML code you already have for the NC page. Then I can explain to you how the data is sent. Right now, all i can tell you is that the key to it is in your opening tag. You'll have attributes in it like - method ... This is the attribute that determines how your data is sent - action .... This is the attribute that contains your PHP file... for data reception. there are more, but there not exactly necessary at this time to know, but if you're curious. - name - enctype - and a few more that I can't remember.
-
Explain "freezing". ... and elaborate your actual question more. What exactly are you wanting to do?
-
This is really all you need to know. What you need to learn, is how to take advantage of it. They are both SUPERGLOBALS, which in essence is just another array.... that you can use everywhere! - assuming you use session_start() and all that. The question you have to ask yourself if WHAT do you want to be accessible.. and where. - the server - the client If you store it in the client superglobal $_COOKIE, then that user can simply go to his temp files or wherever and see these cookies. I also believe you can just view ALL your cookies in Firefox... If you store it on the server superglobal $_SESSION, then only your scripts can access the information.
-
Well apparently var $oldkey works then Line 7 is bad because it begins with public. Take out the public part and it'll go to line... something higher than 7 which would be the other "public" function Take note that in PHP4, public, private, protected and static didn't exist. The quick and dirty solution is to take all the private/protected/public parts out. The ultimate fix would be to upgrade to PHP5, in which OOP is implemented correctly.. or traditionally rather.
-
QFT just change it to this if you want the current time. $DateAndTime = date('d-m-y', time()); strtotime is meant to do exactly what the function suggests.. turn a string into a timestamp. An example string being. $variable = strtotime("4 days ago");
-
You must be running PHP4. take away the protected/private parts. In other words.. protected $oldKey becomes var $oldKey or simply... $oldKey = null;
-
What is inside the variable $DateAndTime?
-
What have you tried? What errors have you gotten? Also, zipcode databases are a dime a dozen. ------ In fact, I even posted a few links to some of them in this post http://www.phpfreaks.com/forums/index.php?topic=208965.0
-
Running this little script should get you started. $connection = @mysql_connect("localhost", "root", "") or die(mysql_error());; $dbs = @mysql_list_dbs($connection)or die(mysql_error()); while ($database = mysql_fetch_assoc($dbs)){ echo "\n" . print_r($database) . "\n\n "; } or with fetch_array $connection = @mysql_connect("localhost", "root", "") or die(mysql_error());; $dbs = @mysql_list_dbs($connection)or die(mysql_error()); while ($database = mysql_fetch_array($dbs)){ echo "\n" . print_r($database) . "\n\n "; }
-
Since mysql_list_dbs returns a MySQL resource pointer, you should be using mysql_fetch_array or mysql_fetch_assoc in your while loop, instead of mysql_num_rows. while ($database = mysql_fetch_assoc($dbs)){
-
Whenever you load data, edit and element or add an element through jQuery.. it becomes something out of scope. In order to access the new links you have AJAXed in, you need to use the live() function. For example $(".search_button, .search_spg").live('click', (function()
-
Since data-id is an attribute you have to select it as one $("div[data-id]").val(videoData['id']).addClass('ppc_thumb_playing');
-
Let the training Begin, World Competition here i come.
Zane replied to phpSensei's topic in Miscellaneous
Download the PHP Manual.. it will come in very handy.. as well as the MySQL manual, if it's downloadable. In fact, considering you're limited to your internet access.. I'd suggest getting the manual for any language you plan on using... or at least take some good notes on the APIs Things like - Javascript AND jQuery - CSS tips and tricks - browser compatibility tips. -
Strange outcoming using ?action= in a hyperlink
Zane replied to Freedom-n-Democrazy's topic in PHP Coding Help
Dumbest apology ever.