Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About MyLifeForIre

  • Rank
  1. The Following code is from one of my PHP forms. everything works up until what i have highlighted in orange. i have double checked my server variables and i am not getting any error codes, the data from my forms simply is not being passed to the associated database fields. <html> <body> <link href="../css/PHP-BG.css" rel="stylesheet" type="text/css"> <h1>Thank you for your submission</h1> <?php //telling the time of day greeting $time = date("H"); if ($time < "10") { echo "<h2>Good Morning Champion!</h2>" . "<br>"; } elseif ($time < "15") { echo "<h2>Good day Champion!</h2>" . "<br>"; } else { echo "<h2>Good Evening Champion!</h2>" . "<br>"; } //end of time of day greeting code //set all form entry data to blank $CharName = $CharHair = $EyeColor = $PriAttribute = $AltAttribute = $comments =""; //form data entry $CharName = $_REQUEST['CharName']; $CharHair = $_REQUEST['CharHair']; $EyeColor = $_REQUEST['EyeColor']; $PriAttribute = $_REQUEST['PriAttribute']; $AltAttribute = $_REQUEST['AltAttribute']; $comments = $_REQUEST['comments']; //end form data entry // echo statement to print form entry results echo $CharName; echo "<br>"; echo "A Truly mighty Hero and worthy of your $PriAttribute Attribute. Thank you for sharing"; echo "<br>"; // This is the output that needs to be placed in the PHP files to initiate and insert data into existing tables $servername = "xxxx"; $username = "xxxx"; $password = "xxxx"; $dbname = "xxxx"; // Create connection $link = mysql_connect("xxxx", "xxxx", "xxxx", "xxxx"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // items need to reflect whats in database $sql = "INSERT INTO CharBuild (CharName, HairColor, EyeColor, PriAttribute, AltAttribute) VALUES ('Grognak', 'White', 'Ice Blue', 'Strength', 'Charisma')"; if(mysqli_query($link, $sql)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } mysqli_close($link); ?> </body> </html>
  2. I finally got the PHP page to be responsive as i need it to be. the last issue im having is my form is not passing data to my database tables. i have the database set up and running, all the fields are set up as they should be and i do not get any errors when trying to submit data. it just doesn't show up
  3. im running the code from my webpage. so my local machine is the webserver? i guess im not sure
  4. This is the start of my php page code <html> <body> <h1>Thank you for your submission</h1> <?php //form data entry $gamertag = $_POST['gamertag']; $lname = $_POST['lastname']; $fname = $_POST['firstname']; $email = $_POST['email']; //end form data entry // echo statement to print form entry results echo $gamertag; echo "<br>"; echo "$fname $lname"; echo "<br>"; echo $email; echo "<br>"; ?>
  5. when attempting to execute a form in HTML the resulting php page only echos the code instead of executing it. Any help is greatly appreciated <div class="form-popup" id="myForm"> <form action="../php/mtg2.php" class="form-container" target="_blank" id="MTG-form" > <h1>Give Us Your MTG Card Details</h1> <p><label for="cardname"><b>Card Name:</b></label> <input name="cardname" type="text" required placeholder="Archangel Of Thune" autocomplete="on" maxlength="30"></p> <p><label for="cardcolor">Card Color:</label> <input name="cardcolor" type="text" required placeholder="White/Black" autocomplete="on" maxlength="30"></p> <p><label for="releaseyear">Card Release Year:</label> <input name="lastname" type="text" required placeholder="Magic 14" autocomplete="on" maxlength="30"></p> <p><label for="releasepack">Release Pack:</label> <input name="releasepack" type="text" required placeholder="Guilds Of Ravnica" autocomplete="on" maxlength="30"></p> <p><textarea name="comments" cols="36" rows="10" maxlength="150" id="comments" placeholder="Dont see one here thats hot or have a Release pack not listed? Let us know!"></textarea></p> <input type="button" class="btn" value="Submit" <!-- this is the button for the add card form --> <button type="submit" class="btn" onClick="openForm">Submit</button> <button type="button" class="btn cancel" onClick="closeForm()">Close</button> </form> </div> <script> function openForm() { document.getElementById("myForm").style.display = "block"; } function closeForm() { document.getElementById("myForm").style.display = "none"; } </script>
  • Create New...