View Full Version : php form action

06-11-2005, 11:59 PM
im trying to concatenate a variable once a form is submitted, is this ok?
$result1 = mysql_fetch_array($query1);
echo "<form method=get action=search_by_date.php?$c_number=".$result1['C_NUMBER'].">"

06-12-2005, 02:32 AM
try this

$result1 = mysql_fetch_array($query1);
echo "<form method=\"get\" action=\"search_by_date.php?c_number=" .$result1['C_NUMBER']. "\">";

you dont need the $ sign when passing variables through the url
id personally use post instead of get

06-12-2005, 02:43 AM
in situations like this, it is correct W3C to use:

<form method="post" action="search_by_date.php">
<input type="hidden" name="c_number" value="<?=htmlentities ($result1['C_NUMBER'])?>">


Remember, use HTMLENTITIES when you output variables into a html element so that " can be converted to &quot; and what not ...

06-13-2005, 04:15 PM
Mr ego, that helped me a lot, I have a webpage with an affiliation system and I echo the links on the page, ofthenthey have an id attached, wich leads to ampersands everywhere in my page. Thanks!!