Need help finishing parts of a project

Hello guys, i asked for help before and you guys were so great im going ot one more time with the final parts of what i need help with.

-i need help getting a program to ask the user to type a word and have it spelled back to them backwards.

  • making a form that has a text field, radio list, check box list and a drop down menu.
    -having a webpage ask a user to input two numbers and then making the average out for them.
    -how to make a if/else statement that shows the largest of 3 placed numbers.
    -how to print all numbers that are divisible by 3 from 100 to 200.

any help at all would be greatly appreciated, im really new to php and for some reason i just cant get this stuff to work.

Did you try to do any of the listed tasks, or do you just want someone to do all of this for you? If you are learning, you need to try… if you face problem while you’re trying - you can post it here.

Here is a quick code for your first task, but I suggest that you try to do your other tasks yourself - they all are pretty simple.
[php]

Reversing a word <?php if(isset($_POST['word']) and $_POST['word']!=''){ // if word was submitted // reverse word $w = strrev($_POST['word']); // echo result echo 'Your word: '.htmlspecialchars($_POST['word']).'
'; echo 'Reversed word: '.htmlspecialchars($w).'
'; } ?> Enter a word: [/php]

hey thanks, well to be honest its for my girlfriend, shes try’d to make these and she just cant figure some of them out.

I also know nothing about coding so thats why i came here.

- making a form that has a text field, radio list, check box list and a drop down menu. -having a webpage ask a user to input two numbers and then making the average out for them.

Google search on how to make a form.

Then process the named number fields on the actioned php page to
[php]<?php
$average = ($_POST[field1] + $_POST[field2]) / 2;
echo $average;
?>[/php]

hey thanks! were trying to get it to work, and this is as far as she can get and now doesn’t know what to do.
[php]

Average of 2 numbers Number 1:
Number 2: <?php $average = ($_POST['1number'] + $_POST['2number']) / 2; echo $average; ?> [/php]

any ideas on why?

Normally, variable name must start from letter (not digit). So, I would suggest to use ‘number1’ and ‘number2’ for field names. Also, you do not need 2 submit buttons, you only need one - so you can just delete the second one.

As for the rest, you code looks fine and should work properly after you make these changes.

[php]

Average of 2 numbers Number 1:
Number 2: <?php $average = ($_POST['1number'] + $_POST['2number']) / 2; echo $average; ?> [/php]

this is what she has now and the answer always is 0, but other than that its good. why would it always be 0?

Are you kidding? If you renamed form fields, why didn’t you update variable names in php code?
$_POST[‘1number’] must be $_POST[‘number1’]
$_POST[‘2number’] must be $_POST[‘number2’]

im sorry if you are getting agitated, but she said she did what you said and it still wont change from 0.
[php]

Average of 2 numbers Number 1:
Number 2: <?php $average = ($_POST['number1'] + $_POST['number2']) / 2; echo $average; ?> [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service