Form not inputting to table

So I have my database set up with with the appropriate values. But when I input values into the form my database stays at 0 rows with nothing going into it.

Here’s the site…

http://wiiklygamer.byethost16.com/

And heres my code…

Please excuse my sloppy layout

[php]

Wiikly Gamer <?php //include("header.php"); //can we use mysql? if(!function_exists('mysql_connect')) die("MySQL extension not enabled"); //connect to mysql server $db=mysql_pconnect('sql209.#######.com','########,'#######') or die(mysql_error()); mysql_select_db('#########_courses') or die(mysql_error()); //find our script name $script = $_SERVER['PHP_SELF']; ?>

<?php //are we being posted to? if($_SERVER['REQUEST_METHOD'] == "POST"){ //yes! set our variables $youtube_name = (isset($_POST['youtube_name'])) ? mysql_real_escape_string($_POST['youtube_name']) : ''; $mm_name = (isset($_POST['mm_name'])) ? mysql_real_escape_string($_POST['mm_name']) : ''; $course_title = (isset($_POST['course_title'])) ? mysql_real_escape_string($_POST['course_title']) : ''; $courseid = (isset($_POST['courseid'])) ? mysql_real_escape_string($_POST['couseid']) : ''; $sql = "INSERT INTO db_1 (youtube_name, mm_name, course_title, courseid) VALUES('$youtube_name', '$mm_name', '$course_title', '$courseid')"; mysql_query($sql) or die(mysql_error()); ?> <?php }else{ //they didn't fill something in $error = true; } } if(isset($error) || $_SERVER['REQUEST_METHOD'] != "POST"){ //show the form ?>


Youtube Name:
Mario Maker Name:
Course Title:
Course ID:
<?php } ?> [/php]

You are using bad and obsolete code from the html to the php. Look at PDO, Kevin Rubio has a starter tutorial, html5 has been out for a while, you should be using that unless you have a reason to give allowance for IE8 and below.

Thanks for the reply I appreciate it.

I haven’t coded anything in a long time.

Time to do some research I guess.

Is it just the HTML that’s outdated? Have I used a lot of obsolete code? or just a small section.

Things like bgcolor and font face are long gone. Mysql_ functions have been dead for 10 years and are not in the current php version, so pconnect and Mysql_real_escape shouldn’t be used.

I’m long out of the game.
Although 10 years? I’m using code I was taught in university which I left 6 years ago.
bgcolor and font face are working but that wouldn’t explain why nothing is inputting to the form.

I’m stumpred.

How much would you want me to donate for you to fix the code for me if you have the time?

Pm me.

Take what you learnt about web in uni and dump it. I take it they taught you using Dreamweaver too! ;D

Sponsor our Newsletter | Privacy Policy | Terms of Service