looking for study partner/s to learn PHP!

Guys im trying to do the seo mike test, and everything works but when I try to put a button for "Go Back" after they get told they are an asshole for not entering their name in getting errors.

Im trying

echo "<a href="www.sitename.com/">Go Back</a>" ;

Apparently your not allowed to do this, so any tips on how to enter a URL instead?

EDIT: Figured it out. Test at
fotinetworks.com/fux.html
EDIT 2: Heres my php code if anyones interested.

<?php

$personname = $_POST['personname'] ;



if ($personname == null) {
echo "Enter your name asshole";
echo "<br />";
echo "<a href=\"http://www.fotinetworks.com/fux.html\">Go Back</a>";

}
else {
echo "Hello $personname";
}



?>
 


Slight technical problem. My hosting is at 1and1 and i am having issues with mysql. Fist off mysqli doesnt work, you have to use mysql. Second off apparently i cant query my databes or something because i need to change some permissions, which of course i cant do!! Any suggestions please?
 
Chapter 2 answer

Man that was stressfull! Turns out you need a .htaccess file for 1and1 to use php 5 This problem is unique to 1and1 apparently, which was nice. :repuke: Found the answer on the headfirst forum eventually.

Aliens Abducted Me - Report an Abduction

report.php
Code:
<?php

// script varaibles
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$when_it_happened = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$fang_spotted = $_POST['fangspotted'];
$other = $_POST['other'];
$email = $_POST['email'];

// database connection
$dbc = mysqli_connect('***', '***', '***', '***') or die('Error connecting to MySQL server.');

// SQL query
$query = "INSERT INTO aliens_abduction (first_name, last_name, when_it_happened, how_long, " .
    "how_many, alien_description, what_they_did, fang_spotted, other, email) " .
    "VALUES ('$first_name', '$last_name', '$when_it_happened', '$how_long', '$how_many', " .
    "'$alien_description', '$what_they_did', '$fang_spotted', '$other', '$email')";

// issue query
$result = mysqli_query($dbc, $query) or die('Error querying database.');

// close database connection
mysqli_close($dbc);

//HTML response
echo 'Thanks for submitting the form.<br />';
echo $first_name . ' ' . $last_name .', you were abducted ' . $when_it_happened . ' and gone for ' .  $how_long . '.<br />';
echo 'Number of aliens: ' . $how_many . '.<br />';
echo 'Describe them: ' . $alien_description . '.<br />';
echo 'What they did: ' . $what_they_did . '.<br />';
echo 'Was Fang there? ' . $fang_spotted . '.<br />';
echo 'Other comments: ' . $other . '.<br />';
echo 'Your email address is ' . $email;

?>
.htaccess for 1and1
Code:
AddType x-mapp-php5 .php
Any comments?
 
to anyone who is following this thread and participating, it's a good idea to go get a cheap VPS server with CPanel. That way you can have a lot more control of things while still being able to rely on CPanel as you're learning.

You can get something like this for like $20 a month, so it's not bad at all
 
Quick question for mods

Hi, is there any chance of getting the PHP BBCODE tag fixed. I mean get the syntax coulours changed. It was obviuosly intended for a white background.
b4.png

I have had a look and its not single values in a css file, it is in the tag:
<span style"color rgb .. etc">
it must be generated on the fly from somwhere else.
If anybody can get this sorted i would use it and im sure other people would. It might make things a bit clearer. Matbe CMYK would work? Anyway, no big deal.
Thanks
 
Hi, is there any chance of getting the PHP BBCODE tag fixed. I mean get the syntax coulours changed. It was obviuosly intended for a white background.
b4.png

I have had a look and its not single values in a css file, it is in the tag:
<span style"color rgb .. etc">
it must be generated on the fly from somwhere else.
If anybody can get this sorted i would use it and im sure other people would. It might make things a bit clearer. Matbe CMYK would work? Anyway, no big deal.
Thanks

Just use the quote tag. No colors, but its more readable
 
How would you go about doing that?

Well now that would be telling!! you need to display the form, process the reults then decide if the form needs to be displayed again or the results.

Let me know if u get stuck.

*hint: you can check if a field has been submitted blank with the php function empty() PHP: empty - Manual

good luck!
 
I have subscribed to the thread and I have the Head first book. Greyhat, please put me down for the server/ webspace.

Give me a couple days to catch up with you guys. I have always wanted to learn PHP so this is a definite step in the right direction.
 
Just chiming in here, I'll try to check in and help too.

I know it's great to know how to do all these things you're leaning in PHP, but to be honest, I haven't touched a manually created form in forever, and could care less how to do it. This is because I use CMS's to handle that shit (I have sites on Wordpress and Drupal, but there's also Joomla).

My recommendation is to continue on your path for a couple more weeks, but at some point, it's time to learn the stuff IMPORTANT to your next project. For me, this includes:

- Object handling
- String handling and parsing
- Array handling (arrays of all kinds)
- File I/O
- How your CMS actually uses these languages, and how the CMS works with MySQL

No reason to build your own PHP site. Figure out what CMS you think you'll use, and then figure out how to integrate good PHP into that. If you know how to code already, you'll most likely spend more time learning how to properly code Drupal/WordPress/Joomla modules/widgets/plugins/etc than doing the actual PHP itself.

Loops are loops, arrays are arrays, PHP has a fuckload of string functions. Better to understand your goals, find the CMS that can get you 90% there, and do the rest yourself in some PHP (and get ready to be on php.net constantly).
 
I have subscribed to the thread and I have the Head first book. Greyhat, please put me down for the server/ webspace.

Give me a couple days to catch up with you guys. I have always wanted to learn PHP so this is a definite step in the right direction.

No problem.
 
Boy I got thrown a loop for doing it on the same page. I setup the proper empty tag on the form page, but I have no clue how to make it run after the button is clicked. Any tips?
 
Boy I got thrown a loop for doing it on the same page. I setup the proper empty tag on the form page, but I have no clue how to make it run after the button is clicked. Any tips?

Without looking i think you need to set the form action to point to itself, i mean point to the script. Can you post the code? Always post the code when you are looking for help.
 
Boy I got thrown a loop for doing it on the same page. I setup the proper empty tag on the form page, but I have no clue how to make it run after the button is clicked. Any tips?

Have the form action point the script itself, then run a conditional check for the existence of the $_POST variable to determine what to do on page load.
 
Yo Greyhat I am totally new to this but I would really like to be a part of this. What do I need to do?