NameSilo

PHP people please help.

Spaceship Spaceship
Watch

Coolprogram

Established Member
Impact
7
Okay i just want a little help on this. I want to be able have my test for html tell you if you are wrong or not. It is in PHP. So can somone please help. If you click the Test above it will take you to the HTML test or Quiz.I want to know because you dont have to be right to go to the next test question.
Oh and the test is not completed i just did it quick.
Thanks a lot,
-Coolprogram
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Sorry man, I didn't understand a thing
 
0
•••
maybe this will make it more clear okay if you visit my site www.programmingplus.info/test.php you will see that i just have a link it doesnt say you are wrong try again like i would like it too here is the code
test.php
PHP:
<html>
<body>
<center>
<h1>Quiz</h1>
</center>
<h3>
Which one is the correct way to start an HTML Document?</h3>
<br>

<form action="cool2.php" method="POST">
<input type="radio" name="quiz" value="Correct"> <HTML>
<br>
<input type="radio" name="quiz" value="Wrong"> <XHTML>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset All">
</form>

<?php

if($_POST['submit'])
{
$quiz = $_POST['quiz'];

if($quiz == "Correct")
{
echo 'You are Correct';
}
else
{
echo 'Wrong.';
}
}
?>
</body>
</html>

cool.php
PHP:
<html>
<body bgcolor=white>
<body text=black>
<b>
 <?php echo $_POST["quiz"]; ?>.<br />
Okay If you are correct click<u><a href="test2.php">here.</a></u></h1></b>
</body>
</html>

I want it to say that yuo failed and it makes you retry.
Thanks,\
-Coolprogram
 
0
•••
You could try something like this:

PHP:
<html> 
<body> 
<center> 
<h1>Quiz</h1> 
</center> 
<h3> 
Which one is the correct way to start an HTML Document?</h3> 
<br> 

<form action="test.php" method="POST"> 
<input type="radio" name="quiz" value="Correct"> <HTML> 
<br> 
<input type="radio" name="quiz" value="Wrong"> <XHTML> 
<br> 
<input type="submit" name="submit" value="Submit"> 
<input type="reset" name="reset" value="Reset All"> 
</form> 

<?php 

if($_POST['submit']) 
{ 
$quiz = $_POST['quiz']; 

if($quiz == "Correct") 
{ 
echo 'You are Correct.<br> Click<u><a href="test2.php">here.</a></u>'; 
} 
else 
{ 
echo 'Wrong. <a href="javascript:history.back(-1)">Try again</a>'; 
} 
} 
?> 
</body> 
</html>
 
Last edited:
0
•••
change this

PHP:
<?php 

if($_POST['submit']) 
{ 
$quiz = $_POST['quiz']; 

if($quiz == "Correct") 
{ 
echo 'You are Correct'; 
} 
else 
{ 
echo 'Wrong.'; 
} 
} 
?>

to this

PHP:
<?php 

if($_POST['submit']) 
{ 
$quiz = $_POST['quiz']; 

if($quiz == "Correct") 
{ 
echo 'You are Correct'; 
} 
else 
{ 
echo 'Wrong. Please hit your browser back butten and try again'; 
} 
} 
?>
 
0
•••
Yeah i would do it SV but i cannot figure out how to get the java script stuff to quit repeating itself you try it.
 
0
•••
Coolprogram said:
Yeah i would do it SV but i cannot figure out how to get the java script stuff to quit repeating itself you try it.
Repeating itself?? Hmm then replace it with:

HTML:
<a href="javascript:history.back();">Try again</a>
 
0
•••
0
•••
Ohh, nvmd.. You can remove the back link altogether. And everything will be fine. As it tells you wether it's right or wrong now on the same page.. I didn't know what you meant earlier ;)
 
0
•••
i think he means the page is repeating itself ?
 
0
•••
0
•••
Come one people help me here.

Come on people help me out i know some of you guys know this. Know what i will pay someone 15NP$ if they do what i want them to do.How's that sound?
Oh and i will also pay 10NP$ if somone will help me decide a Domain name for my new website.
 
0
•••
Here is a few ideas.

First thing make it stay in one page If you could post php of both php files I will combine them into one.

Once you post both I will fix it up for you.

Where do you want it to go after it finshes?

iNod
 
0
•••
I am not sure what you are saying INod. Can you please re word it diferently?
Thank you,
-Coolprogram
 
0
•••
Could you please post php script for test.php and tutorial.php so I can edit them

Thanks,
 
0
•••
Okay that makes it a lot easier for me to understand.


test.php
PHP:
<html>
<body>
<center>
<h1>Quiz</h1>
</center>
<h3>
Which one is the correct way to start an HTML Document?</h3>
<br>

<form action="test.php" method="POST">
<input type="radio" name="quiz" value="Correct"> <HTML>
<br>
<input type="radio" name="quiz" value="Wrong"> <XHTML>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset All">
</form>

<?php

if($_POST['submit'])
{
$quiz = $_POST['quiz'];

if($quiz == "Correct")
{
echo 'You are Correct.<br> Click<u><a href="tutorial.php">here.</a></u>';
}
else
{
echo 'Wrong. <a href="javascript:history.back()">Try again</a>';
}
}
?>
</body>
</html>

Tutorial.php
PHP:
<html>
<body>
<center>
<h1>Quiz</h1>
</center>
<h3>
Which one is the correct way to start an HTML Document?</h3>
<br>

<form action="test.php" method="POST">
<input type="radio" name="quiz" value="Correct"> <body bgcolor=green>
<br>
<input type="radio" name="quiz" value="Wrong"> <bg color=green>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset All">
</form>

<?php

if($_POST['submit'])
{
$quiz = $_POST['quiz'];

if($quiz == "Correct")
{
echo 'You are Correct.<br> Click<u><a href="tutorial.php">here.</a></u>';
}
else
{
echo 'Wrong. <a href="javascript:history.back()">Try again</a>';
}
}
?>
</body>
</html>
-Coolprogram

Ohhhh my god ifigured out my mistake. Never mind i dont need help on that any more my bad i forgot to change something :lol: ooopppsss
 
0
•••
Coolprogram said:
Okay that makes it a lot easier for me to understand.


test.php
PHP:
<html>
<body>
<center>
<h1>Quiz</h1>
</center>
<h3>
Which one is the correct way to start an HTML Document?</h3>
<br>

<form action="test.php" method="POST">
<input type="radio" name="quiz" value="Correct"> <HTML>
<br>
<input type="radio" name="quiz" value="Wrong"> <XHTML>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset All">
</form>

<?php

if($_POST['submit'])
{
$quiz = $_POST['quiz'];

if($quiz == "Correct")
{
echo 'You are Correct.<br> Click<u><a href="tutorial.php">here.</a></u>';
}
else
{
echo 'Wrong. <a href="javascript:history.back()">Try again</a>';
}
}
?>
</body>
</html>

Tutorial.php
PHP:
<html>
<body>
<center>
<h1>Quiz</h1>
</center>
<h3>
Which one is the correct way to start an HTML Document?</h3>
<br>

<form action="test.php" method="POST">
<input type="radio" name="quiz" value="Correct"> <body bgcolor=green>
<br>
<input type="radio" name="quiz" value="Wrong"> <bg color=green>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset All">
</form>

<?php

if($_POST['submit'])
{
$quiz = $_POST['quiz'];

if($quiz == "Correct")
{
echo 'You are Correct.<br> Click<u><a href="tutorial.php">here.</a></u>';
}
else
{
echo 'Wrong. <a href="javascript:history.back()">Try again</a>';
}
}
?>
</body>
</html>
-Coolprogram

Ohhhh my god ifigured out my mistake. Never mind i dont need help on that any more my bad i forgot to change something :lol: ooopppsss

Would you like me to show you how to combine both of these into one file?
So index.php and index.php?i=2

Thanks,
iNod
 
0
•••
do I still have to pay you if i do? if so then No. Otherwise of course. Oh and can you help me pick a name for my next site? you will get 10NP$ if i like it.
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back