I posted here yesterday with a problem on submiting a form. THANKS to those people who took the time out to help this poor newbie.
I re-evaluated my entire script. Below is what I have now. It still doesn't work. All I get is a blank page. I have the form on a standard html page with no scripting on it. which targets this PHP. As I say, all I get is a blank page with no errors (see the first two lines).
Could someone please talk to me like a stupid 4yr old' 'cause I just don't seem to be grasping this.
Thanks in advance for your help.
The PHP community ROCKS!!
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
$link = mysql_connect('localhost', 'root', 'root');
$db = mysql_select_db('jobs4alltrades', $link);
if(isset($_POST['loginid'])) {
$insert = "INSERT INTO members ('loginid', 'password', 'firstname', 'surname', 'email', 'trade', 'address1', 'address2', 'address3', 'address4', 'postzip', 'country', 'yearsexp', 'about') VALUES ('".$_POST['loginid']."', '".$_POST['password']."', '".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['email']."', '".$_POST['trade']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['address3']."','".$_POST['address4']."', '".$_POST['postzip']."', '".$_POST['country']."','".$_POST['yearsexp']."','".$_POST['about']."')";
$result = mysql_query($insert, $link);
if(!$link){
echo "problem linking to mysql";
}
if(!$db){
echo "prob with db name";
exit;
}
if (!!$result) {
echo "Your details was succesfully added to our database. Use the navigation bar above to take you where you want to go next<br><br>"";
}
else ($result) {
echo "Nope, not this time";
}
}
$QUERY = "SELECT 'loginid', 'password' FROM members";
$RESULT = mysql_query($QUERY);
if(mysql_num_rows($RESULT) > 0) {
echo "<p>Rows in table: <ol>";
while($row = mysql_fetch_assoc($RESULT)) {
echo "<li>". $row['loginid'] ." = ". $row['password'] ."</li>";
}
echo "</ol></p>";
}
else {
echo "<p>No rows exist in the table</p>";
}
?>