Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3790348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:18:02+00:00 2026-05-19T12:18:02+00:00

I seem to have a bit of a problem here that I can’t quite

  • 0

I seem to have a bit of a problem here that I can’t quite figure out.

So the deal is I have a php script along with an HTML file, in that file I have a few forms with some text boxes and some drop downs. Now the reason I had to go single forms on all of these was because if I did one big one none of them would work when I would hit the submit button. I have no idea… My current code is below, my previous code only had one form and it wouldn’t work at all.

          <form method="post" id="locationFromPost" name="locationFormPost">
                                <div class="formRow">
                                    <div class="label">
                                        <label for="locationForm">Current Location:</label>
                                    </div>

                                    <div class="field">
                                            //If post is null go back to value pull originally else echo post           
                                               <?php if($_POST['locationForm']==null) $location=$location;else $location=$_POST['locationForm']; ?>             
                                        <input type="text" name="locationForm" id="locationForm" value="<?php echo $location?>"></input>
                                    </div>
                                </div>
                            </form>

…… and so on…….

           <form method="post" id="sexFromPost" name="sexFormPost">    
                          <div class="formRow">
                                <div class="label">
                                    <label for="sexForm">Sex</label>
                                </div>

                                <div class="dropDown">
                                    <select name="sex" id="sexForm" >
//If post is null go back to value pull originally else echo post                                   
                              <?php if($_POST['sexForm']==null) $sex=$sex;else $sex=$_POST['sexForm']; ?>
                                        <option value="1" <?php if($sex==1){echo"selected='selected'";}?>>Male</option>
                                        <option value="2" <?php if($sex==2){echo"selected='selected'";}?>>Female</option>
                                        <option value="3" <?php if($sex==3){echo"selected='selected'";}?>>Not Specified</option>
                                    </select>
                                </div>
                             </div>
            </form>

…… and so on…….

    <form method="post" id="submit" name="submit">
    <div class="formRow"><div id="seperator"></div></div>
                    <div class="submitButton">
                        <input type="submit" name="submit" id="submit" value="Save Changes"/> 
                    </div>          
                </div>
</form>

So thats what the top part of my code looks like, all the div’s are for formatting you don’t have to worry about those. Now the php code to save the information is below. I should note that the variables you see in the php parts of the code above are retrieved from the Database in the earlier part of the code, thats working fine. What I am having problems with is I want a user to be able to edit their information then just hit the submit button and the information to be saved. What currently happens is, well, absolutely noting. The page will refresh and all the values will go back to what they were when they were pulled, they are not stored in the DB at all, now I checked to make for sure that part of the code works, buy doing some test. It saves the data no problem. What I thin is the problem is the forms them-selfs, if I do everything in one big form it doesn’t work… Don’t know why. now if I hit enter at the end of each of the forms individually in the browser the data goes in but just that field, sometimes other fields are wiped completely out and a null or empty string is stored. I cant seem to figure this thing out at all.

heres the php to save the information.

<?php
if (isset($_POST['submit']))
{ 
mysql_query("UPDATE members SET location= '".$_POST['locationForm']."' WHERE usr='" .mysql_real_escape_string($_SESSION['usr']) ."'");
mysql_query("UPDATE members SET location= '".$_POST['sexForm']."' WHERE usr='" .mysql_real_escape_string($_SESSION['usr']) ."'");

........ you know the rest.......
}?>

I am completely lost at why this thing is doing this, now im not the best PHP programmer by any-means, so it could (probably is) be me. If anyone could point out what I would need to do to get a system like that working please let me know

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:18:03+00:00Added an answer on May 19, 2026 at 12:18 pm

    I wasn’t clear exactly what your problem was.

    However this:

     <?php if($_POST['locationForm']==null) $location=$location;else $location=$_POST['locationForm']; ?> 
    

    Doesn’t look to me like it is going to do much. Try something like this:

    <?php 
        if(!isset($_POST['locationForm'])){
           $location=$location;
        }
       else {
           $location=$_POST['locationForm'];
        } 
    ?> 
    

    (Curly braces are my own personal liking)

    Assuming you have $location defined somewhere you didn’t show us. This will check if there is NOT a $_POST[‘locationForm’], and if there is it will use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of a problem that I can't seem to code my
Okay, so I have searched this site quite a bit and I can't seem
I'm having a strange issue that I can't seem to figure out. I tried
The question might seem a bit confusing but I have an if statement that
I have quite a fundamental problem that none of my selenium phpunit tests pass
I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
I seem to have a problem passing some strings on from one form to
I seem to have found a bug in jQuery UI that duplicates dragged elements
So I have a bit of a problem. When I ask MooTools to send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.