Jump to content

[SOLVED] Feeding data from php form to Web link


martyoo

Recommended Posts

<?php
if (!isset($_POST[submit])) {
    $form = "yes";
} elseif (isset($_POST[submit])) {
    header("Location: http://website.net/sendsms.aspx?s=m&d=$_POST[d]&m=$_POST[m]");
    exit;
} //end if

if ($form == "yes") {
    $display = "<form action = \"$_SERVER[php_SELF]\" method = \"post\">\n";
    $display .= "<table border = 0>\n";
    $display .= "<tr>\n";
    $display .= "<td align = \"right\">D:</td>\n";
    $display .= "<td><input type = \"text\" name = \"d\"></td>\n";
    $display .= "</tr>\n\n";
    $display .= "<tr>\n";
    $display .= "<td align = \"right\">M:</td>\n";
    $display .= "<td><input type = \"text\" name = \"m\"></td>\n";
    $display .= "</tr>\n\n";
    $display .= "<tr>\n";
    $display .= "<td></td>\n";
    $display .= "<td><input type = \"submit\" name = \"submit\" value = \"Go\"></td>\n";
    $display .= "</tr>\n";
    $display .= "</table>\n";
    $display .= "</form>\n";
} //end if
?>

<html>
<head>
<title>Test Page</title>
</head>
<body>
<p><?php print "$display"; ?></p>
</body>
</html>

 

 

That should do it!

Link to comment
Share on other sites

Ok, so with that code it brings up two form fields asking for D and M and when I fill it in it works fine, but what I wanted to do was to get the D and M areas of the web link filled in automatically  and then it would visit the site with the new data.

Is this possible?

Thanks again

 

Marty

Link to comment
Share on other sites

I must be doing something wrong because when I fill out the form and then submit it through the form that Neptunus made it brings up two empty fields.

If I then enter data on those two fields and click Go it works perfectly. But I wanted it all to happen automatically.

So what I mean is when the data is entered in the form fields the data is then added onto the link and the user is brought to the site.

Am I doing something wrong with the script?

Thanks

 

Marty

Link to comment
Share on other sites

You don't need all the code that Neptunus made. All you need is....

 

<form action="http://website.net/sendsms.aspx?s=m" method="get">
  <input type="text" name="d">
  <input type="text" name="m">
  <input type="submit">
</form>

 

as I said in my first reply. Use get as your forms method.

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.