Jump to content

[SOLVED] Need some help with a form. Noob question.


nastynate604

Recommended Posts

Hello All,

 

I am very new to coding with PHP and I need some help with a form that I am creating.  It is very basic, and all I need to do is get an email address and a password from a form and then pass that information in a link.  The link looks like this:

 

http://my.site.com/validation.aspx?E=$email&P=$password&ID=ADRCOLTC

 

I have my form set up as a "GET" and the action is set up with the link above.  When the person hits submit on the form however, the email address is passed as:  name%40email.com  instead of name@email.com in the link.

 

If anyone can help me out with this or give me some suggestions it would be much appreciated.  I know this is a rather noobish question but I can't seem to find the answer anywhere.  I found a couple of functions urldecode(); and rawurldecode(); but I can't seem to get those to work and i'm not sure if that is where I need to be looking.

 

Thanks!

 

 

Link to comment
Share on other sites

The link only works when the email address (with an @ sign) and the password are visible in the link.  I know that sounds incredibly wrong but that is how that link works.  At what point within the code do I need to use:  urldecode($_GET['email']);

 

Would I use something like this?:

 

$email = urldecode($_GET['email']);

 

Within the Form?  Outside the form?  Contained within <? ?> in the actual action link?  Thank you for your replies!

Link to comment
Share on other sites

You actually shouldnt even need the urldecode() function.  The $_GET['E'] value should have the normal "@" already.  $_GET is a php array containing values passed as a query string.  So whatever you have that needs to use the submitted email just set <? $email = $_GET['E']; ?>  This would be after the form is submitted.

Link to comment
Share on other sites

Ok, let's forget $_GET for a moment.  What if I wanted to do this with $_POST variables instead.

 

Here is my form:

 

<form id="form1" name="form1" method="POST" action="http://site.site.com/validation.aspx?E=$email&P=$password&ID=ADRCOLTC">

          <table width="100%" border="0" cellspacing="10" cellpadding="0">

            <table width="100%" border="0" cellspacing="0" cellpadding="5">

              <tr>

                <td colspan="2" align="center"><strong>Existing Users Please Sign In Below:</strong></td>

              </tr>

              <tr>

                <td align="right">email address:</td>

                <td><input type="text" name="email" value="" /></td>

              </tr>

              <tr>

                <td align="right">password:</td>

                <td><input type="password" name="password" value="" /></td>

              </tr>

              <tr>

                <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Submit" /></td>

              </tr>

            </table>

            <tr>

              <td colspan="2" align="center"> </td>

            </tr>

            <tr>

              <td> </td>

            </tr>

            <tr>

              <td colspan="2" align="center"> </td>

            </tr>

            <tr>

              <td colspan="2" align="center"><p>Please verify your email and password is correct or you<br />

              may be taken to the incorrect login page.</p></td>

            </tr>

        </form>

 

How would I be able to pass the $email and $password fields from the form into the Link that is contained in the Form Action?  I know there is some PHP involved i'm just not sure where to put it.. help!

Link to comment
Share on other sites

no thats impossible. the variables you are trying to access don't actually exist when you are trying to access them. what exactly are you trying to do? url_decode() theoretically should work, depending on what you are trying to do.

 

However, you could really just set the action to http://site.site.com/validation.aspx and instead of using the $_GET array, use the $_POST array on that aspx page

Link to comment
Share on other sites

Hmm. Ok i'm not really sure if i'm explaining it correctly then.

 

You see the form i've created.  I need to take the info that is put into the Email field, and the Password field and when the form is submitted I need that information added to the link under the form action=""  So where it says ?E=&P=  I need the E= to use what is in the email field and the P= to use what is in the password field.

 

I do not have access to the ASP file on the other end, all I am doing is passing what is contained in the variables to that action link and the .ASPX page is supposed to do the rest.

 

Does this make sense?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.