Jump to content

[SOLVED] Why will this not pass as a POST?


Navajo

Recommended Posts

Three text boxes being initially populated by three variable strings.  I want the user to edit the strings and then get the 3 new values of the text boxes and POST them to a new .php script.

 

Can someone shed some light on what I need to do?

 

<FORM>
<center>
<input name="productIDCode" type="text" id="productIDCode" value="<?php echo "$productIDCode" ?>" size="32" /><br /><br />
<input name="prodDescription" type="text" id="prodDescription" value="<?php echo "$description" ?>" size="32" /><br /><br />
<input name="prodAssesment" type="text" id="prodAssesment" value="<?php echo "$assesmentLimit" ?>" size="32" />

<?PHP

if (!isset($_POST['prodDescription']))
{
	$prodDescription2 = $_POST['prodDescription'];
	print ($prodDescription2);
}
else
{
	$prodDescription2 = 0;
}
?>

<br /><br />

<?php    
echo "<INPUT TYPE=\"BUTTON\" VALUE=\"Save\" ONCLICK=\"window.location.href='saveEdit.php?prID=$prodDescription2'\">"
?>    
</FORM>

Link to comment
https://forums.phpfreaks.com/topic/147139-solved-why-will-this-not-pass-as-a-post/
Share on other sites

#1

 

don't do

 

echo "$varname"

 

#2

 

I don't think you need to terminate single line php things but..

 

I usually do.. try

 

<?php echo $varname; ?>

 

I do not see if you'er even setting $varname

 

but if you arn't that would be your problem as I'm assuming php isn't spitting out parse errors and double quotes WILL evaluate a variable..

ok so now i have:

 

<FORM>
<center>
<input name="productIDCode" type="text" id="productIDCode" value="<?php echo "$productIDCode" ?>" size="32" /><br /><br />
<input name="prodDescription" type="text" id="prodDescription" value="<?php echo "$description" ?>" size="32" /><br /><br />
<input name="prodAssesment" type="text" id="prodAssesment" value="<?php echo "$assesmentLimit" ?>" size="32" />
<?php

$prodDescription = 'prodDescription';

?>

<br /><br />

<?php    
echo "<INPUT TYPE=\"BUTTON\" VALUE=\"Save\" ONCLICK=\"window.location.href='saveEdit.php?prID=$prodDescription'\">"
?>    
</FORM>

 

How do I get it to pass the value of the text box?

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.