Jump to content

evx

New Members
  • Posts

    3
  • Joined

  • Last visited

evx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here's my new php code: <?php $connect = mysql_connect("localhost", "root", "abid1221") or die(mysql_error()); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $username = mysql_real_escape_string($_POST['Username']); $email = mysql_real_escape_string($_POST['Email']); $firstname = mysql_real_escape_string($_POST['First']); $lastname = mysql_real_escape_string($_POST['Last']); $day = mysql_real_escape_string($_POST['Day']); $month = mysql_real_escape_string($_POST['Month']); $year = mysql_real_escape_string($_POST['Year']); $time = mysql_real_escape_string($_POST['Time']); $position = mysql_real_escape_string($_POST['Position']); $why = mysql_real_escape_string($_POST['Why']); $what = mysql_real_escape_string($_POST['What']); $exp = mysql_real_escape_string($_POST['Exp']); $hours = mysql_real_escape_string($_POST['Hours']); $comments = mysql_real_escape_string($_POST['Comments']); mysql_select_db($connect, "evxhotel") or die(mysql_error()); $sql = mysql_query ($connect, "INSERT INTO apps (username, email, realname, dob, time, position, why, what, exp, hours, comments) VALUES ('".$username."', '".$email."', '".$firstname/$lastname."', '".$day/$month/$year."', '".$time."', '".$position."', '".$why."', '".$what."', '".$exp."', '".$hours.", '".$comments); if($sql) { echo "Your applicaton has been added to the database."; } else { die(mysql_error()); } } ?> Still; No difference. Im getting lost here :[
  2. Thanks I got rid of the ". How am I ment to stop it from dividing the vars and put them together instead? thanks. This is what the html code looks like for the submit button: <br /> <input type="submit" value="Submit your application" name="submit"> <br /> <br /> </form> </body> </html>
  3. Hi. I have made a application form for a job, I want the results the user enters into the boxes to come out into my database (evxhotel and the table apps). I get no errors and the website works perfectly fine but when I fill the form and submit the page just reloads and when I go to check my database I see that my results of the form are not in the database. I believe that maybe I put the mysql_connect and the mysql_select_db on the wrong lines. BTW, this is only the php script embedded into a html document. The file format and name is form.php. All the tags are correct. <?php $connect = mysql_connect("****", "****", "****") or die(mysql_error()); if(isset($_POST['submit'])){ $username = mysql_real_escape_string($_POST['Username']); $email = mysql_real_escape_string($_POST['Email']); $firstname = mysql_real_escape_string($_POST['First']); $lastname = mysql_real_escape_string($_POST['Last']); $day = mysql_real_escape_string($_POST['Day']); $month = mysql_real_escape_string($_POST['Month']); $year = mysql_real_escape_string($_POST['Year']); $time = mysql_real_escape_string($_POST['Time']); $position = mysql_real_escape_string($_POST['Position']); $why = mysql_real_escape_string($_POST['Why']); $what = mysql_real_escape_string($_POST['What']); $exp = mysql_real_escape_string($_POST['Exp']); $hours = mysql_real_escape_string($_POST['Hours']); $comments = mysql_real_escape_string($_POST['Comments']); mysql_select_db($connect, "evxhotel") or die(mysql_error()); $sql = mysql_query ("INSERT INTO apps (username, email, realname, dob, time, position, why, what, exp, hours, comments) VALUES ('".$username."', '".$email."', '".$firstname/$lastname."', '".$day/$month/$year."', '".$time."', '".$position."', '".$why."', '".$what."', '".$exp."', '".$hours.", '".$comments."')", $connect); if($sql) { echo "Your applicaton has been added to the database."; } else { die(mysql_error()); } } ?> Whats wrong? Thanks in advance.
×
×
  • 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.