evx
-
Posts
3 -
Joined
-
Last visited
Posts posted by evx
-
-
Couple things wrong in the query string.
This part - '".$firstname/$lastname."', '".$day/$month/$year."', is trying to divide the vars, not put them in the way you are wanting.
Second you have a stray " after the ) for the VALUES portion.
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>
-
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.
Form results to database
in PHP Coding Help
Posted
Here's my new php code:
Still; No difference. Im getting lost here :[