Jump to content

Can I Use Php Code Inside Html Form Action ?


EzwanAbid

Recommended Posts

I'm trying to passing a data by url.. and what I want to know here, is it possible to insert php code inside <form action> ? Like this :

<form id="form56" name="form56" class="wufoo topLabel page" autocomplete="off" enctype="multipart/form-data" method="post" novalidate
action="<?php searchres.php?id=$id?>">

 

Or is there any better way that I can try?

Hope someone can help me here. :)

I think you mean to do this:

action="searchres.php?id=<?php echo $id; ?>">

 

PS: Remember to typecast the ID to an integer (by using (int)) when retrieving it from wherever, to ensure that no-one can put any HTML content into it and thus attack your users with an XSS (or similar).

wow Thank you Christian.. I never expect it was you again..

Thx it's working ! :happy-04: .. but I have another question here..

 

Can I use this code to call 2 field from my database into my html?

mysql_query("SELECT adminfullname,department FROM admin WHERE id='$id'");

 

Those adminfullname and department will refer to the admin table where $id that I send by url just now.

Yes, I don't see any problems with it. Though, except the slight issue that integer values shouldn't be quoted in SQL queries. Assuming $id is an integer, and that you've properly type-cast it. ;)

 

You're welcome, btw. :)

Thank you very much for helping me all this time Christian... I really appreciate that :happy-04:

I think that was the last question from me for now..because in 4 days I need to present my system to my lecturer as my Finalproject in Diploma IT-Sofware .. and hope they will like it .. :lol:

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.