Specials | Announcements | Contact | Site Map
Willmaster.com
Hijack-proof forms. Surveys. List building.

Solid, safe website tools.

Whatever your need, Will Bontrager builds powerful software solutions.

Affiliate Cookie Setter
Search WillMaster.com:

WillMaster > Support > CGI Q&A

If you don't find the answer to your question in these archives, ask your CGI question at the Current Master Series CGI Forum.

Auto Submission

Author Message
24Feb04

S.Balkhis
Subject: Auto Submission

Sir,
I need to automate the variables(value) submission automatically.
I'm getting values from html form and converting the username into aray like username1, username2.... and each time
and user is created it should be posted to some other script where the other required operations are done. I need to know how this could be done.
i'm appending below the two scripts
First one where i get values:

<?

$PH_No = "131343";
$Add= "Ooty";

if($Name)
{
$Name1 = $Name;
$str ="<html><head><title>Test</title></head><body><form method=\"post\" action=\"Test.php\">";

for($i=1; $i<=$No; $i++)
{

$Name = $Name.$i;

$str .="<input type =\"text\" name=\"Name\" value=\"$Name\"><input type=\"int\" name=\"PH_No\" value=\"$PH_No\"><input type=\"text\" name=\"Add\" value=\"$Add\">";
$Name = $Name1;
}
$str .="<input type=\"submit\" name=\"sub1\" value=\"submit\"></form></body></html>";
$str .="<input type=\"submit\" name=\"sub1\" value=\"submit\"></form></body></html>";
print $str;
}
?>
<HTML>
<HEAD>
<Addition of Users>
<TITLE>
Test Program to add Users
</TITLE>
</HEAD>
<BODY>
<FORM ACTION="samp.php">

UserName : <INPUT TYPE="text" NAME="Name" VALUE="


PhoneNo : <INPUT TYPE="int" NAME="PH_No" VALUE="


Address : <INPUT TYPE="text" NAME="Add" VALUE="


No.of Users: <INPUT TYPE="text" NAME="No">


<INPUT TYPE="submit" VALUE="submit">


</FORM>
</BODY>
</HTML>

Note: When the above is executed, (say for 5 users) all the five users gets displayed but only the last stored value of Name is posted to Test.php and i can't use arrays bcoz, the second script "Test.php" can't be modified by me and in "Test.php" only variables are declared not arrays.
========================================Second script where the required operation has to be done after getting all the user names.

<?
if(!$Name || !$PH_No || !$Add)
{
print "Enter UserName & PhoneNo";
}
else
{
print "UserName = $Name, PhoneNo = $PH_No and Address = $Add";
}
$db_Name = "Samp";
$table = "SubscriberDetail";
$db_host = @mysql_connect("192.168.0.236", "bluebill", "bluebill") or die("Couldn't Connect");
$db= @mysql_select_db($db_Name, $db_host);
$sql = "insert into $table values(\"$Name\", \"$PH_No\", \"$Add\")";
$result=@mysql_query($sql, $db_host) or die ("Couldn't execute query");
?>
<HTML>
<HEAD>
<Addition of Users>
<TITLE>
Test Program to add Users
</TITLE>Test Program to add Users
</TITLE>
</HEAD>
<BODY>
<FORM METHOD="post">

UserName: <INPUT TYPE="text" NAME="Name">


PhoneNo : <INPUT TYPE="int" NAME="PH_No">


Address : <INPUT TYPE="text" NAME="Add">


<INPUT TYPE = "submit" VALUE="submit">


</FORM>
</BODY>
</HTML>

========================================
Please let me know what can be done to post the values automatically for each user.

Thanks & Regards,
Balkhis

24Feb04

Will

[Email]

In response to: Auto Submission

Balkhis, it appears that you're working with PHP.

Probably a PHP help group can answer your question. I'm sure there are discussion groups and forums dedicated to PHP.

(I have only a little experience with PHP.)