0

I am not sure where I am wrong here. I am doing it like I always used to do but the form variables are not getting passed to the URL.

My code is below:

<form id="update_submit" name="update_submit" method="post" action="profile_update.php" >
    <h3 class="ghj" style="color:white">
        <input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white;" type="text" id="name1" name="name1" value="<?php echo $fullname_1; ?>" required /> | 
        <input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white" type="text" id="city" name="city" value="<?php echo $city_1; ?>" required />
    </h3>
    <div class="bs-example">
        <table class="table">
            <tbody>
                <tr>
                    <td style="color:white">
                        <h1 style="color:white;font-size:150%" class="head"  id="h1.-bootstrap-heading">
                            <span style="background-color: black;"> 
                                <input style="width:400px;background: grey;border: 2px solid #D8D8D8;color:grey" type="text" id="email" name="email" value="<?php echo $email_1; ?>" required disabled />
                            </span>
                        </h1>
                        <span style="background-color: black;">
                            Phone : <input style="background: rgba(0, 0, 0, 0);border: 2px solid  #D8D8D8;color:white" type="text" id="phone" name="phone" value="<?php echo  $phone_1; ?>" required />
                        </span>
                    </td>
                    <td class="type-info"></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<div class="submit-btn">
    <input type="submit" value="Update" style="background-color:   #585858;color:white">
</div>
</form>

Any help will be highly useful.

6
  • What is the expected behavior? And what do you mean with 'getting passed to the URL'? Commented Oct 17, 2015 at 17:41
  • when I press the submit button...then the url should be redirected to profile_update.php like this /mysite.com/if/profile_update.php Commented Oct 17, 2015 at 17:43
  • So you don't want to pass the variables to the URL, but to your script (profile_update.php) without adding them to the URL Commented Oct 17, 2015 at 17:46
  • @Deva Well yeah, your variables will be posted over http to profile_update.php, but what are you getting there in $_POST? Commented Oct 17, 2015 at 17:48
  • @Bastiaan : didn't understand your question..... I am not getting anything in $_POST...but I change the method to get and it worked :) ....thanks a ton everyone for the support Commented Oct 17, 2015 at 17:54

3 Answers 3

1

You need get method, edit form to:

 <form id="update_submit" name="update_submit" method="get" action="profile_update.php" >

Get method puts variables in url, post method put variables in http headers.

Sign up to request clarification or add additional context in comments.

1 Comment

get method puts variables in url, post method put variables in http headers.
0

Pay attention to the disable attribute on the input email, this value will not be posted. Maybe you should use readonly instead.

2 Comments

@Deva yes, i tested your form on my local server and they pass.
Do you have javascript that do something before submit?
0

You have to change the method of how to send the form. You got several options, GET and POST.


  • get Default. Appends the form-data to the URL in name/value pairs: URL?name=value&name=value
  • post Sends the form-data as an HTTP post transaction

Be aware of this.

So to use GET change method to GET.

Example: <form id="update_submit" name="update_submit" method="GET" action="profile_update.php">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.