Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP question?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
I have a great Ebook you can use PM me msn info?
Would be useful.
 
0
Close
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
Close
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
Close
0
Close
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
Close
I want to do that on PHP okay the script but with PHP.
 
0
Close
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
Close
Aleiua Thanks SV. I needed to know that soo much. now i can get back to my work.
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back