Jump to content

Pulling Info from a form to fill a variable in another script


katarra

Recommended Posts

Ok, here is my dilemna. Thanks in advance for any help!

 

I have a text field that someone enters a set of coordinates into. I need to take those coordinates and then convert them into a variable ($c) that can then be used to edit a room script. I have a text field for them to enter, and then a separate *submit* button below that will initiate the action to the next script.

 

Here are my two files so far:

 

Input the Coordinates:

<td><INPUT TYPE=text NAME=editcoords SIZE=30></td>			
<td>
<p align="center">
<form name="editlevels" method="post" action="powers/levelgen_admin.php">
<input type=hidden value="" name="Coords">
<input type="submit" value="Edit a Level">
</form>
</p></td>

 

Where I need the coordinates inserted into:

You are editting <?=$c?>.<br><br>
<form action=levedit.php method=post>
<table border=0><tr>
<td>
TITLE:<br>
<input type=text name=title value="<?=$title?>">
<br><br>
CURRENT:<br>
<textarea name=descript rows=10 cols=50><?=$descript?></textarea>
<br><br>
ALTERNATE:<br>
<textarea name=alt rows=10 cols=50><?=$alt?></textarea>
</td>

<td valign=top width=30%>
<table width=100% style=text-align:center><tr>
<td width=33%> </td>
<td width=33%>
NORTH:<br>
<select name=n>
<option value=0>No</option>
<option value=1 <? if ($n == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$n?>
</td>
<td width=33%>
UP:<br>
<select name=u>
<option value=0>No</option>
<option value=1 <? if ($u == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$u?>
</td>
</tr></table>

<br>

<table width=100% style=text-align:center><tr>
<td width=50%>
WEST:<br>
<select name=w>
<option value=0>No</option>
<option value=1 <? if ($w == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$w?>
</td>
<td width=50%>
EAST:<br>
<select name=e>
<option value=0>No</option>
<option value=1 <? if ($e == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$e?>
</td>
</tr></table>

<br>

<table width=100% style=text-align:center><tr>
<td width=33%>
DOWN:<br>
<select name=d>
<option value=0>No</option>
<option value=1 <? if ($d == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$n?>
</td>
<td width=33%>
SOUTH:<br>
<select name=s>
<option value=0>No</option>
<option value=1 <? if ($s == 1) echo "selected" ?>>Yes</option>
</select><br>Was <?=$u?>
</td>
<td width=33%> </td>
</tr></table>
</td>
</tr>
<tr><td colspan=2>
<input type=hidden name=p value=<?=$p?>><input type=hidden name=co value=<?=$c?>><input type=hidden 

name=username value=<?=$username?>><input type=hidden name=password value=<?=$password?>><input 

type=hidden name=no value=<?=$no?>>
<input type=submit value="Edit Level"> <input type=reset value=Reset>
</td></tr></table>

For Input the Coordinates, the <form> tag needs to encompass the entire form. Try this

<form name="editlevels" method="post" action="powers/levelgen_admin.php">
<td><INPUT TYPE="text" NAME="editcoords" SIZE="30"></td>         
<td>
<p align="center">
<input type="submit" value="Edit a Level">
</p></td>
</form>

 

To pull the info from the above form, use $_POST like this

<?PHP
$c = $_POST['editcoords'];
?>
You are editting <?PHP echo $c; ?>.<br><br>
<form action="levedit.php" method="post">
<table border=0>
<tr>
<td>
TITLE:<br />
<input type="text" name="title" value="<?PHP echo $title; ?>">
<br /><br />
CURRENT:<br />
<textarea name="descript" rows="10" cols="50"><?PHP echo $descript; ?></textarea>
<br /><br />
ALTERNATE:<br />
<textarea name="alt" rows="10" cols="50"><?PHP echo $alt; ?></textarea>
</td>
<td valign=top width=30%>
<table width="100%" style="text-align:center">
<tr>
<td width=33%> </td>
<td width=33%>
NORTH:<br />
<select name="n">
<option value="0">No</option>
<option value="1" <?PHP if ($n == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $n; ?>
</td>
<td width=33%>
UP:<br />
<select name="u">
<option value="0">No</option>
<option value="1" <?PHP if ($u == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $u; ?>
</td>
</tr>
</table>
<br />
<table width="100%" style="text-align:center">
<tr>
<td width="50%">
WEST:<br />
<select name="w">
<option value="0">No</option>
<option value="1" <?PHP if ($w == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $w; ?>
</td>
<td width=50%>
EAST:<br />
<select name="e">
<option value="0">No</option>
<option value="1" <?PHP if ($e == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $e; ?>
</td>
</tr>
</table>
<br />
<table width="100%" style="text-align:center">
<tr>
<td width="33%">
DOWN:<br />
<select name="d">
<option value="0">No</option>
<option value="1" <?PHP if ($d == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $n; ?>
</td>
<td width=33%>
SOUTH:<br />
<select name="s">
<option value="0">No</option>
<option value="1" <?PHP if ($s == 1) { echo "selected"; } ?>>Yes</option>
</select><br />Was <?PHP echo $u; ?>
</td>
<td width=33%> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="p" value="<?PHP echo $p; ?>"><input type="hidden" name="co" value="<?PHP echo $c; ?>"><input type="hidden" name="username" value="<?PHP echo $username; ?>"><input type="hidden" name="password" value="<?PHP echo $password; ?>"><input type="hidden" name="no" value="<?PHP echo $no; ?>"><input type="submit" value="Edit Level"> <input type="reset" value="Reset">
</td>
</tr>
</table>
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.