Jump to content

Recommended Posts

I have the following code:

[code]
<?php
  //ini variables and get values
  $fname = $_POST['fname'];
  $minitial = $_POST['minitial'];
  $lname = $_POST['lname'];
  $email = $_POST['email'];
  $phone = $_POST['phone'];
  $altphone = $_POST['altphone'];
  $address = $_POST['adress'];
  $city = $_POST['city'];
  $state = $_POST['state'];
  $zip = $_POST['zip'];
  $country = $_POST['country'];
  $interested = $_POST['interested'];
  $experience = $_POST['experience'];
  $teaching = $_POST['teaching'];
  $lessonhubexp = $_POST['lessonhubexp'];
  $bio = $_POST['bio'];
  $personalinfo = $_POST['personalinfo'];
  $webconference = $_POST['webconference'];
  $contact = $_POST['contact'];
  $hoursmonth = $_POST['hoursmonth'];
  $felony = $_POST['felony'];
  $felonyexp = $_POST['felonyexp'];
  $inetconnection = $_POST['inetconnection'];
  $webcam = $_POST['webcam'];
  $computer = $_POST['computer'];
  $sound = $_POST['sound'];
  $terms = $_POST['terms'];
 
  $errors = array();
 
  //do serverside validation of required fields for those that have javascript turned off
  if ($fname = "") {
  $errors[] = "First Name";
  }
  elseif ($lname = "") {
  $errors[] = "Last Name";
  }
  elseif ($email = "") {
  $errors[] = "Email Address";
  }
  elseif ($phone = "") {
  $errors[] = "Phone Number";
  }
  elseif ($address = "") {
  $errors[] = "Address";
  }
  elseif ($city = "") {
  $errors[] = "City";
  }
  elseif ($state = "") {
  errors[] = "State";
  }
  elseif ($zip = "") {
  errors[] = "Zip/Postal Code";
  }
  elseif ($country = "") {
  errors[] = "Country";
  }
  elseif ($interested = "") {
  errors[] = "Your Teaching Interests";
  }
  elseif ($bio = "") {
  errors[] = "Biography";
  }
  elseif ($personalinfo = "") {
  errors[] = "Personal Information";
  }
 
  $size = sizeof($errors);
 
  if ($size == 0) {
  //connect to db and insert values
  mysql_select_db("lessonhub", $linkID);
  $insert = "INSERT INTO Instructor (FName, MI, LName, Address1, City, StateProvidence, PostCode, Phone1, Phone2, Country, Bio, Email, TeachInterest, YearExperience, WorkForLH, YearofTeach, InterestLH, WebInterview, ContactInt, TenHour, Felony, FelExplain, IntSpeed, webcam, goodComputer, soundCard, terms) VALUES ($fname, $minitial, $lname, $address, $city, $state, $zip, $phone, $altphone, $country, $bio, $email, $interested, $experience, $lessonhubexp, $teaching, $personalinfo, $webconference, $contact, $hoursmonth, $felony, $felonyexp, $inetconnection, $webcam, $computer, $sound, $terms)";
  if (mysql_query($insert, $linkID)) {
print "Your application has been sent sucessfully. We will contact you shortly to complete the process.";
}
else {
print "There was an error sending your application. Please go back and submit your information again.";
}
  }
  else {
  print "Please go back and fill out the following items:<br>";

foreach ($errors as $value) {
print "$value<br>";
}
  }
  ?>
[/code]

It gives me a blank screen with no errors. Anyone see where I am going wrong?
Link to comment
https://forums.phpfreaks.com/topic/26161-blank-screen/
Share on other sites

One problem I found is you started to use $error[] = 'Your error message here';

then you went to error[] = 'Your error message here'; (note the lack of the dollar sign before error[])

You start to do the above from line 53 and onwards:
[code]elseif ($state = "") {
  errors[] = "State";
  }
  elseif ($zip = "") {
  errors[] = "Zip/Postal Code";
  }
  elseif ($country = "") {
  errors[] = "Country";
  }
  elseif ($interested = "") {
  errors[] = "Your Teaching Interests";
  }
  elseif ($bio = "") {
  errors[] = "Biography";
  }
  elseif ($personalinfo = "") {
  errors[] = "Personal Information";
  }[/code]

that's your problem!
Link to comment
https://forums.phpfreaks.com/topic/26161-blank-screen/#findComment-119637
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.