PHP : passing a variable along url [message #179050] |
Fri, 07 September 2012 11:12 |
pritam chavla
Messages: 1 Registered: September 2012
Karma: 0
|
Junior Member |
|
|
Hi group i am having a problem now, actually i am trying to submit a form
and want to pass a parameter along url like
this is my form that is on url(http://localhost/userregistration.php)
<form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >
<dl>
<dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
</dl>
<dl>
<dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
</dl>
</form>
this is form is submitting on userhandler.php where i am planning to take another parameter org_name
so far i am passing the org_name on
http://localhost/userregistration.php?org_name=blah
but unfortunately when i am trying to get the parameter on userhandler.php file
it is showing me error i.e
Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16
Please help me what i am doing wrong
|
|
|
Re: PHP : passing a variable along url [message #179051 is a reply to message #179050] |
Fri, 07 September 2012 11:16 |
Captain Paralytic
Messages: 204 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Friday, September 7, 2012 12:12:36 PM UTC+1, pritam chavla wrote:
> Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16
> Please help me what i am doing wrong
I would help you but my crystal ball is playing up and it is only showing me up to line 15!
|
|
|
|
Re: PHP : passing a variable along url [message #179053 is a reply to message #179050] |
Fri, 07 September 2012 12:06 |
Olaf S.
Messages: 10 Registered: December 2011
Karma: 0
|
Junior Member |
|
|
Am 07.09.2012 13:12, schrieb pritam chavla:
> Hi group i am having a problem now, actually i am trying to submit a form
>
> and want to pass a parameter along url like
> this is my form that is on url(http://localhost/userregistration.php)
> <form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >
>
> <dl>
> <dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
> </dl>
>
> <dl>
> <dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
> </dl>
Add this line:
<input type="hidden" name="org-name" value="blah">
>
>
> </form>
>
|
|
|
|
Re: PHP : passing a variable along url [message #179079 is a reply to message #179076] |
Tue, 11 September 2012 13:34 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 9/11/2012 8:51 AM, vivek wrote:
> On userhandler.php define the variable org_name
> if($_GET['org_name']!='')
> {
> $org_name = $_GET['org_name'];
> }
> else
> {
> $org_name = '';
> }
>
>
Which will give an E_NOTICE if $_GET['org_name'] is not set.
You should always use isset() to ensure a parameter is set before trying
to use it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|