Jump to content

data drops, db doesn't KEY, and form looks funky


olga

Recommended Posts

HI here is the link:

http://www.halloweentechnozombiegeocache.com/contact-us.html

I have spent to many hours trying to make this work.  I am finally asking for help.. I have scoured the w3 schools pages and it still doesnt work.. it's not their fault..but somewhere I am missing something.... help please?

First off..

what is this and where is it from?  I did not add this in on the page myself??!?!??!       data_liveedit_tagid="0x00007fc9868a5b80">

Second.. how do I get the php commands out of the fields?  

 <form name="contact-us" id="form1" method="POST" enctype='multipart/form-data' action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
    <label for="firstname">First Name</label>
    <input type="text" id="firstname" name="firstname" value="<?php echo $firstname;?>" placeholder="Your first name.." required>
<span class="error">* <?php echo $firstnameErr;?></span>

I added the little script value="<?php echo $firstname;?>"   into the value fields so that the form woul hang onto the info when it gets posted..

 I don't want it to show up for the user to see that code ..

B) the form still sends an empty email even with the code.  Without the code, it also sends an empty email.

 

So then I added the mysql db. thinking that perhaps it eas because it had no place to store the info before it sent the email...

another trip on it's own . It's been a number of years since I was adept at mysql. so ... I have the columns set up correctly as far as I can tell, and I'm trying to add an "id' column as well so that it auto increments a number for each message sent. but the server side phpadmin error messages keeps telling me that it needs to be a KEY, so when I define it as a KEY, it gives me an error message saying I can only have one.. but it is the only one... I use 1and1.com.. any one able to guide me on what i am doing wrong here please?

 

Thanks

 

Link to comment
Share on other sites

Apparently 'data_liveedit_tagid...' is used to help preview in Dreamweaver, which I advise you never use and always preview in browser instead.

If you are going to set input value  on returning to form which should only be done if error encountered, or confirming you need to predefine the variable first, then check variable needs to be updated if form submission takes place.

$firstname = $firstnameErr ="";

if( isset($_POST['firstname']) && !empty($_POST['firstname'])){

$firstname=$_POST['firstname'];

}

You should also have code so that once all information require from sender and details of recipient email, subject etc  are retrieved they are processed for sending email via header() and php email you tend to use. No storing of these fields is necessary unless they are registering on your site.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...