The online racing simulator
PHP Script needed!
Ok guys i need a script in witch something like this happends
user types something into the text box ie:11b
the script checks a php file to find what the user entered
if the entered text wasnt found it displays the following error
Question Bot Version Not found. Please check on the news page for the latest Question Bot verison.


this sounds like some sort of homework. is it a piece of homework?
Quote from St4Lk3R :this sounds like some sort of homework. is it a piece of homework?

Totally!
... This is really not hard... even a n00b at PHP like myself could do this (maybe not the _BEST_ but adequately). The logic behind it is even easy.

Pseudoish-Code:
- (if you want, define the desired value as a constant, but can also be done as a variable)
- send the input box using POST or GET to a new php script (or itself if you want)
- in the new script (or same, with cleverly placed if statements and isset functions), set a variable to be the desired value from the POST array
- do a comparison (with an if statement) and output the desired thing.

EDIT: http://dustindawes.com/mogey.php

There's an example, doing what I explained above in actual code (all contained in the same script), the "good" value is "11b", anything else shows the error. (This took painfully long compared to how it should have, I blame it on Apple.)
Quote from dawesdust_12 :... This is really not hard... even a n00b at PHP like myself could do this (maybe not the _BEST_ but adequately). The logic behind it is even easy.

Pseudoish-Code:
- (if you want, define the desired value as a constant, but can also be done as a variable)
- send the input box using POST or GET to a new php script (or itself if you want)
- in the new script (or same, with cleverly placed if statements and isset functions), set a variable to be the desired value from the POST array
- do a comparison (with an if statement) and output the desired thing.

EDIT: http://dustindawes.com/mogey.php

There's an example, doing what I explained above in actual code (all contained in the same script), the "good" value is "11b", anything else shows the error. (This took painfully long compared to how it should have, I blame it on Apple.)

i dont get it.
Ok, lets break it down further:

- Create a form (Basic HTML)

<html>
<head>
<title>My Form</title>
</head>
<body>
<form action="process.php" method="POST">
<input type="text" name="value">
<input type="submit" name="submit">
</form>
</body>

- Set your "correct" value as a variable or constant (lets call this $correct)

<?php 
 $correct 
"11b";
?>

- Check the POST or GET value depending on how you're sending your form to the processing script (http://ca.php.net/manual/en/reserved.variables.post.php for info on accessing a POST value)

<?php 
$value 
$_POST['value']
?>

- Compare your POST/GET value to your $correct value.

<?php 
 
if ($correct == $value) { DO SOMETHING} else{ IF WRONG, DO SOMETHING ELSE!} 
?>

This might be too much of a hint, but it might help a bit without giving the answer entirely. (The PHP bits would need to be in a second "process" script [if you're doing it in a 2 script method, the way I did it uses 1 script to get and process by using cleverly placed if statements] ).
when i try to use the form after i clcik submit it displays text.
What kind of text, an error message or..?
plain text
$correct = "11b"; $value = $_POST["11b"]; if ($correct == $value) { DO SOMETHING} else{ IF WRONG, DO SOMETHING ELSE!};
just remb i dont know anything about php
Yeah, it would do for several reasons:
1) You don't have PHP installed on the server you want to use the script on
2) You don't have the page setup correctly (PHP tags)
3) You actually haffto fill in the logic between the curly brackets, I just provided a base

I'd recommend you to do some reading from w3schools.com on PHP to do the rest of what I've intentionally omitted to provoke learning and thinking, and if you're unwilling to do that much, then I'm unwilling to help anymore than I have.
-
(JasonJ) DELETED by JasonJ

FGED GREDG RDFGDR GSFDG