Dynadot โ€” .com Registration $8.99

PHP question?

Spaceship Spaceship
Watch

Coolprogram

Established Member
Impact
7
Okay I am just starting PHP but i know a lot about it and how to altar it to do what I want. Besides ifs and whats. Can someone help me? Or can you give me an example too work off? If soo thank you very much. If not that is okay 2.


Thanks,
-Coolprogram
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Coolprogram said:
Can someone help me? Or can you give me an example too work off? If soo thank you very much. If not that is okay 2.
I've written a handful of short articles on PHP things .. they're on my website: http://www.ooer.com/ .. they might help you get started. Or not. ;)
 
0
•••
I have a great Ebook you can use PM me msn info?
Would be useful.
 
0
•••
If else php questions

I want to know how to use a php if or else statement. I tried this
Code:
 if (<input type="radio" name="cool" value="radio"> &ltcode>)
echo "Right"
}
else (<input type="radio" name="cool" value="radio"> &ltcose>)
{
Yeah and by the way i dont know how to use if and else statements.
-Coolprogram
 
Last edited:
0
•••
Usually the content within the (brackets) is the condition. and the content within the {curly brackets} is the action for example:

PHP:
if ($beer == 'good')
{ echo "Drink beer"; }
elseif ($beer == 'bad')
{ echo "Don't drink beer"; }
else { echo "give me beer"; }

excuse the example. As you can see, you do not set a condition for "else" unless it is "elseif"
 
0
•••
0
•••
HTML:
<html>
<body>
<form>
<input type="radio" name="sex" value="male"> Male
<br>
<input type="radio" name="sex" value="female"> Female
</form>
</html>

Not sure if that was the page you meant
 
0
•••
I want to do that on PHP okay the script but with PHP.
 
0
•••
Was you meaning something like this? :p

PHP:
<html>
<body>

<form>
<input type="radio" name="sex" value="male"> Male
<br>
<input type="radio" name="sex" value="female"> Female
<br>
<input type="submit" name="submit" value="Submit">
</form>

<?php

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

if($sex == "male")
{
echo 'You are male.';
}
else
{
echo 'You are female.';
}
}

?>

</body>
</html>
 
0
•••
Aleiua Thanks SV. I needed to know that soo much. now i can get back to my work.
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back