Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,554 members, 7,819,969 topics. Date: Tuesday, 07 May 2024 at 07:46 AM

Will This Code Work? - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Will This Code Work? (674 Views)

i need help on this code / Someone Please Help Me With This Code / Help How Do I Backup Mysql Database With This Code (2) (3) (4)

(1) (Reply) (Go Down)

Will This Code Work? by cbrass(m): 4:16pm On Sep 19, 2014
<?php
if(isset($_POST['submitted']))
{
$country_code = $_POST['country_code'];
$phone = mysql_real_escape_string($_POST['phone']);
$text = mysql_real_escape_string($_POST['msg']);
$message = urlencode($text);

if(!empty($phone) && preg_match("/^(\d[\s-]?)?[\(\[\s-]{0,2}?\d{3}[\)\]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i", $phone))
{
$recipient = $phone;
$url = "http://smsclone.com/components/com_spc/smsapi.php?username=cbrass&password=Bleep&sender=admin&recipient=$recipient&message=$message";
}
}

?>
<form method="POST" action="" width="100%">
Phone :<input type="text" name="phone" >
Message:<input type="text" name="msg" >
<input type="submit" name="submit" value="Submit Number">
</form>

have tried it but nothing happened
Re: Will This Code Work? by DualCore1: 4:30pm On Sep 19, 2014
It will not work because you are testing for a condition that will return false.
if(isset($_POST['submitted'])) will always return false as their is no form element with the name "submitted". Change this line

<input type="submit" name="submit" value="Submit Number">

to

<input type="submit" name="submitted" value="Submit Number">


Even at that your code will not give you the desired result, as I see you are trying to send SMS via API.

After this line

$url = "http://smsclone.com/components/com_spc/smsapi.php?username=cbrass&password=Bleep&sender=admin&recipient=$recipient&message=$message";

You must have something like

$response = file_get_contents($url);

To see the response from the server you can echo $response
Re: Will This Code Work? by cbrass(m): 4:45pm On Sep 19, 2014
lol i didnt see that submit error sha
Re: Will This Code Work? by cbrass(m): 4:46pm On Sep 19, 2014
DualCore1: It will not work because you are testing for a condition that will return false.
if(isset($_POST['submitted'])) will always return false as their is no form element with the name "submitted". Change this line

<input type="submit" name="submit" value="Submit Number">

to

<input type="submit" name="submitted" value="Submit Number">


Even at that your code will not give you the desired result, as I see you are trying to send SMS via API.

After this line

$url = "http://smsclone.com/components/com_spc/smsapi.php?username=cbrass&password=Bleep&sender=admin&recipient=$recipient&message=$message";

You must have something like

$response = file_get_contents($url);

To see the response from the server you can echo $response

ok, will try that soon
Re: Will This Code Work? by dhtml(m): 5:54pm On Sep 19, 2014
Trollin'
Re: Will This Code Work? by cbrass(m): 10:10pm On Sep 19, 2014
dhtml: Trollin'

ogami sir, i site u o grin

(1) (Reply)

I Need A Partner For My Social Network / Cpmserve Publishers / Website Designer Needed!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.