submit Button coding

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
parul853
Forum Newbie
Posts: 2
Joined: Wed Sep 26, 2012 12:37 am

submit Button coding

Post by parul853 »

Hi all,
Can anyone tell me the coding of the submit button submitting the two field name and phone no.
pHp_n0ob
Forum Commoner
Posts: 35
Joined: Mon Jul 09, 2012 7:30 am
Location: India

Re: submit Button coding

Post by pHp_n0ob »

What you want, say clearly...according to your question,i think

Code: Select all

<form method="post" name="data" action="target.php"><input type="text" name="name" value="Name"/><input type="number" name="phone" value="Phone Number"/><input type="submit" value="Submit"/></form>
On the page target.php

Code: Select all

<?php if(isset($_POST['name']))
$name=$_POST['name'];
if(isset($_POST['phone']))
$number=$_POST['phone'];
echo $name.' '.$number;?>
johngill2810
Forum Newbie
Posts: 6
Joined: Tue May 14, 2013 9:52 am

Re: submit Button coding

Post by johngill2810 »

Hello,
Your code is here
<form method="post" name="form" action="#.php">
Name:<input type="text" name="nm" value="nm"/>
Phone No:<input type="text" name="pn" value="pn"/>
<input type="submit" value="SUBMIT"/>
</form>
akhilesh1010
Forum Newbie
Posts: 15
Joined: Thu Aug 22, 2013 1:56 am

Re: submit Button coding

Post by akhilesh1010 »

pHp_n0ob wrote:What you want, say clearly...according to your question,i think

Code: Select all

<form method="post" name="data" action="target.php"><input type="text" name="name" value="Name"/><input type="number" name="phone" value="Phone Number"/><input type="submit" value="Submit"/></form>
On the page target.php

Code: Select all

<?php if(isset($_POST['name']))
$name=$_POST['name'];
if(isset($_POST['phone']))
$number=$_POST['phone'];
echo $name.' '.$number;?>
Nice example works fine if i want to store this information in database which is the best mysql or mysqli?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: submit Button coding

Post by requinix »

akhilesh1010 wrote:Nice example works fine if i want to store this information in database which is the best mysql or mysqli?
The mysql extension is dead. Use mysqli (or PDO).
Post Reply